Skip to content

Commit

Permalink
Replace Symfony's MemcachedAdapter with MemcachdAdapter
Browse files Browse the repository at this point in the history
The MemcachedAdapter from Symfony was removed and replaced with MemcachdAdapter. This update occurs in the configuration of the CacheItemPoolInterface that is annotated with 'Shared'. Removed redundant import of
  • Loading branch information
koriym committed May 8, 2024
1 parent bcf137a commit 1b5c844
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/MemcachdAdapter.php → src/MemcachedAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use function func_get_args;

/** @psalm-suppress PropertyNotSetInConstructor */
class MemcachdAdapter extends OriginAdapter implements Serializable
class MemcachedAdapter extends OriginAdapter implements Serializable
{
use SerializableTrait;

Expand Down
14 changes: 7 additions & 7 deletions tests/MemcachedAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

class MemcachedAdapterTest extends TestCase
{
/** @return array{0:string, 1: MemcachdAdapter} */
/** @return array{0:string, 1: MemcachedAdapter} */
public function testSerialize(): array
{
$provider = new MemcachedProvider([['127.0.0.1', '11211']]);
$adapter = new MemcachdAdapter($provider);
$adapter = new MemcachedAdapter($provider);
$adapter->get('foo', static function (ItemInterface $item) {
return 'foobar';
});
Expand All @@ -34,19 +34,19 @@ public function testSerialize(): array
}

/**
* @param array{0:string, 1: MemcachdAdapter} $adapters
* @param array{0:string, 1: MemcachedAdapter} $adapters
*
* @depends testSerialize
*/
public function testUnserialize(array $adapters): void
{
$this->assertInstanceOf(MemcachdAdapter::class, $adapters[1]);
$this->assertInstanceOf(MemcachedAdapter::class, $adapters[1]);
$this->assertSame('foobar', $adapters[1]->get('foo', static function (ItemInterface $item) {
return '_no_serve_in_object';
}));

$adapter0 = unserialize($adapters[0]);
$this->assertInstanceOf(MemcachdAdapter::class, $adapter0);
$this->assertInstanceOf(MemcachedAdapter::class, $adapter0);
$this->assertSame('foobar', $adapter0->get('foo', static function (ItemInterface $item) {
return '_no_serve_in_serialize';
}));
Expand All @@ -59,11 +59,11 @@ protected function configure(): void
{
$this->install(new CacheNamespaceModule('a'));
$this->install(new CacheDirModule('/tmp/a'));
$this->bind(AbstractAdapter::class)->to(MemcachdAdapter::class);
$this->bind(AbstractAdapter::class)->to(MemcachedAdapter::class);
$this->install(new Psr6MemcachedModule('127.0.0.1:6379:1'));
}
});
$adapter = $injector->getInstance(AbstractAdapter::class);
$this->assertInstanceOf(MemcachdAdapter::class, $adapter);
$this->assertInstanceOf(MemcachedAdapter::class, $adapter);
}
}

0 comments on commit 1b5c844

Please sign in to comment.