Memcached
extends AbstractAdapter
in package
Memcached cache adapter class
Tags
Table of Contents
Properties
- $memcached : Memcached|null
- Memcached object
- $ttl : int
- Global time-to-live
- $version : string|null
- Memcached version
Methods
- __construct() : mixed
- Constructor
- addServer() : Memcached
- Get the current version of memcached.
- addServers() : Memcached
- Get the current version of memcached.
- clear() : Memcached
- Clear all stored values from cache
- deleteItem() : Memcached
- Delete a value in cache
- destroy() : Memcached
- Destroy cache resource
- getItem() : mixed
- Get an item from cache
- getItemTtl() : int
- Get the time-to-live for an item in cache
- getTtl() : int
- Get the global time-to-live for the cache object
- getVersion() : string|null
- Get the current version of memcached.
- hasItem() : bool
- Determine if the item exist in cache
- memcached() : Memcached
- Get the memcached object.
- saveItem() : Memcached
- Save an item to cache
- setTtl() : AbstractAdapter
- Set the global time-to-live for the cache adapter
Properties
$memcached
Memcached object
protected
Memcached|null
$memcached
= null
$ttl
Global time-to-live
protected
int
$ttl
= 0
$version
Memcached version
protected
string|null
$version
= null
Methods
__construct()
Constructor
public
__construct([int $ttl = 0 ][, string $host = 'localhost' ][, int $port = 11211 ][, int $weight = 1 ]) : mixed
Instantiate the memcached cache object
Parameters
- $ttl : int = 0
- $host : string = 'localhost'
- $port : int = 11211
- $weight : int = 1
Tags
addServer()
Get the current version of memcached.
public
addServer(string $host[, int $port = 11211 ][, int $weight = 1 ]) : Memcached
Parameters
- $host : string
- $port : int = 11211
- $weight : int = 1
Return values
MemcachedaddServers()
Get the current version of memcached.
public
addServers(array<string|int, mixed> $servers) : Memcached
Parameters
- $servers : array<string|int, mixed>
Return values
Memcachedclear()
Clear all stored values from cache
public
clear() : Memcached
Return values
MemcacheddeleteItem()
Delete a value in cache
public
deleteItem(string $id) : Memcached
Parameters
- $id : string
Return values
Memcacheddestroy()
Destroy cache resource
public
destroy() : Memcached
Return values
MemcachedgetItem()
Get an item from cache
public
getItem(string $id) : mixed
Parameters
- $id : string
getItemTtl()
Get the time-to-live for an item in cache
public
getItemTtl(string $id) : int
Parameters
- $id : string
Return values
intgetTtl()
Get the global time-to-live for the cache object
public
getTtl() : int
Return values
intgetVersion()
Get the current version of memcached.
public
getVersion() : string|null
Return values
string|nullhasItem()
Determine if the item exist in cache
public
hasItem(string $id) : bool
Parameters
- $id : string
Return values
boolmemcached()
Get the memcached object.
public
memcached() : Memcached
Return values
MemcachedsaveItem()
Save an item to cache
public
saveItem(string $id, mixed $value[, int|null $ttl = null ]) : Memcached
Parameters
- $id : string
- $value : mixed
- $ttl : int|null = null
Return values
MemcachedsetTtl()
Set the global time-to-live for the cache adapter
public
setTtl(int $ttl) : AbstractAdapter
Parameters
- $ttl : int