Skip to content

Commit

Permalink
fixup! Refactor code and add serialization test
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed May 13, 2024
1 parent e4b9fb5 commit 3cfd2d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
12 changes: 2 additions & 10 deletions src-deprecated/MemcachdAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,10 @@ class MemcachdAdapter extends OriginAdapter implements Serializable
{
use SerializableTrait;

/**
* @param ProviderInterface<Memcached> $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);
}
}
13 changes: 2 additions & 11 deletions src/MemcachedAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -18,16 +15,10 @@ class MemcachedAdapter extends OriginAdapter implements Serializable
{
use SerializableTrait;

/**
* @param ProviderInterface<Memcached> $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);
}
}

0 comments on commit 3cfd2d6

Please sign in to comment.