CacheMemcached
in package
Class CacheMemcached
Interact with Memcache.
Table of Contents
- $logger : MonologWrapper
- $memcached : Memcached
- __construct() : mixed
- CacheMemcached constructor.
- clear() : bool
- Clear the MmeCache cache.
- get() : mixed
- Fetch a value from MemCache. If the key does not exist, null is returned.
- init() : bool
- Initiate the memcached servers.
- set() : bool
- Store a value in MemCache
- addServer() : bool
- Add a single server to memcached.
Properties
$logger
protected
MonologWrapper
$logger
$memcached
protected
Memcached
$memcached
Methods
__construct()
CacheMemcached constructor.
public
__construct(array<string|int, mixed> $servers, MonologWrapper $logger) : mixed
Parameters
- $servers : array<string|int, mixed>
- $logger : MonologWrapper
Tags
Return values
mixed —clear()
Clear the MmeCache cache.
public
clear() : bool
Return values
bool —get()
Fetch a value from MemCache. If the key does not exist, null is returned.
public
get(string $key) : mixed
Parameters
- $key : string
-
Memcache cache key.
Return values
mixed —init()
Initiate the memcached servers.
public
init(array<string|int, mixed> $servers) : bool
Parameters
- $servers : array<string|int, mixed>
Tags
Return values
bool —set()
Store a value in MemCache
public
set(string $key, mixed $val, int $ttl) : bool
Parameters
- $key : string
-
Memcache cache key.
- $val : mixed
-
Value to store in Memcache.
- $ttl : int
-
Cache TTL.
Return values
bool —addServer()
Add a single server to memcached.
protected
addServer([string $host = '127.0.0.1' ][, int $port = 11211 ][, int $weight = 1 ]) : bool
Parameters
- $host : string = '127.0.0.1'
- $port : int = 11211
- $weight : int = 1