-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from apple-x-co/fix-memcached-bind
Fix Memcached bind
- Loading branch information
Showing
4 changed files
with
45 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Ray\PsrCacheModule; | ||
|
||
use Memcached; | ||
use Ray\Di\Di\Named; | ||
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; | ||
|
||
use function func_get_args; | ||
|
||
/** @psalm-suppress PropertyNotSetInConstructor */ | ||
class MemcachedAdapter 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) | ||
{ | ||
$this->args = func_get_args(); | ||
|
||
parent::__construct($clientProvider->get(), $namespace, $defaultLifetime, $marshaller); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters