From 3cfd2d651b35cec50e3683129e5a45f1eadc8a0b Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 14 May 2024 01:35:22 +0900 Subject: [PATCH] fixup! Refactor code and add serialization test --- src-deprecated/MemcachdAdapter.php | 12 ++---------- src/MemcachedAdapter.php | 13 ++----------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src-deprecated/MemcachdAdapter.php b/src-deprecated/MemcachdAdapter.php index 5f1341b..3f8f3e9 100644 --- a/src-deprecated/MemcachdAdapter.php +++ b/src-deprecated/MemcachdAdapter.php @@ -19,18 +19,10 @@ class MemcachdAdapter extends OriginAdapter implements Serializable { use SerializableTrait; - /** - * @param ProviderInterface $clientProvider - * - * @Named("memcached") - * @CacheNamespace("namespace") - */ - #[CacheNamespace('namespace')] - #[Named('memcached')] - public function __construct(ProviderInterface $clientProvider, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null) + public function __construct(MemcachedProvider $provider, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null) { $this->args = func_get_args(); - parent::__construct($clientProvider->get(), $namespace, $defaultLifetime, $marshaller); + parent::__construct($provider->get(), $namespace, $defaultLifetime, $marshaller); } } diff --git a/src/MemcachedAdapter.php b/src/MemcachedAdapter.php index b4fbf18..239e506 100644 --- a/src/MemcachedAdapter.php +++ b/src/MemcachedAdapter.php @@ -4,9 +4,6 @@ namespace Ray\PsrCacheModule; -use Memcached; -use Ray\Di\ProviderInterface; -use Ray\PsrCacheModule\Annotation\CacheNamespace; use Serializable; use Symfony\Component\Cache\Adapter\MemcachedAdapter as OriginAdapter; use Symfony\Component\Cache\Marshaller\MarshallerInterface; @@ -18,16 +15,10 @@ class MemcachedAdapter extends OriginAdapter implements Serializable { use SerializableTrait; - /** - * @param ProviderInterface $clientProvider - * - * @CacheNamespace("namespace") - */ - #[CacheNamespace('namespace')] - public function __construct(MemcachedProvider $clientProvider, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null) + public function __construct(MemcachedProvider $provider, string $namespace = '', int $defaultLifetime = 0, ?MarshallerInterface $marshaller = null) { $this->args = func_get_args(); - parent::__construct($clientProvider->get(), $namespace, $defaultLifetime, $marshaller); + parent::__construct($provider->get(), $namespace, $defaultLifetime, $marshaller); } }