Documentation

Memcached extends AbstractAdapter

Table of Contents

$memcached  : object
Store the object.
$ttl  : int
Time to live.
$version  : string
Version.
__construct()  : mixed
__construct.
addServer()  : self
Add server to Memcached.
addServers()  : self
Add servers to Memcached.
close()  : void
Close the connection.
deleteItem()  : self
Delete the cache.
destroy()  : self
Remove all caches.
getItem()  : mixed
Get value form the cache.
getItemTtl()  : int|false
Get the time-to-live for an item in cache.
getTtl()  : int
Get the time-to-live for cache.
getVersion()  : string
Get the version of memcache.
hasItem()  : bool
Determine if cache exists.
memcached()  : object
Get the memcached object.
saveItem()  : self
Save an item to cache.
setTtl()  : self
Set the ttl.

Properties

$memcached

Store the object.

private object $memcached
Tags
since
1.0.0

$version

Version.

private string $version
Tags
since
1.0.0

Methods

__construct()

__construct.

public __construct(string $host, int $port, int $weight, int $ttl) : mixed
Parameters
$host : string

Host of memcache

$port : int

Port of memcache

$weight : int

Weight of memcache

$ttl : int

Time to live

Tags
since
1.0.0
Return values
mixed

addServer()

Add server to Memcached.

public addServer(string $host[, int $port = 11211 ][, int $weight = 1 ]) : self
Parameters
$host : string

Host of memcache

$port : int = 11211

Port of memcache

$weight : int = 1

Weight of memcache

Tags
since
1.0.0
Return values
self

addServers()

Add servers to Memcached.

public addServers(array<string|int, mixed> $servers) : self
Parameters
$servers : array<string|int, mixed>
Tags
since
1.0.0
Return values
self

close()

Close the connection.

public close() : void
Tags
since
1.0.0
Return values
void

deleteItem()

Delete the cache.

public deleteItem(string $key) : self
Parameters
$key : string
Tags
since
1.0.0
Return values
self

destroy()

Remove all caches.

public destroy() : self
Tags
since
1.0.0
Return values
self

getItem()

Get value form the cache.

public getItem(string $key) : mixed
Parameters
$key : string
Tags
since
1.0.0
Return values
mixed

getItemTtl()

Get the time-to-live for an item in cache.

public getItemTtl(string $key) : int|false
Parameters
$key : string
Tags
since
1.0.0
Return values
int|false

getTtl()

Get the time-to-live for cache.

public getTtl() : int
Tags
since
1.0.0
Return values
int

getVersion()

Get the version of memcache.

public getVersion() : string
Tags
since
1.0.0
Return values
string

hasItem()

Determine if cache exists.

public hasItem(string $key) : bool
Parameters
$key : string
Tags
since
1.0.0
Return values
bool

memcached()

Get the memcached object.

public memcached() : object
Tags
since
1.0.0
Return values
object

saveItem()

Save an item to cache.

public saveItem(string $key, mixed $value[, int $ttl = null ]) : self
Parameters
$key : string
$value : mixed
$ttl : int = null
Tags
since
1.0.0
Return values
self

setTtl()

Set the ttl.

public setTtl(int $ttl) : self
Parameters
$ttl : int

time to live

Tags
since
1.0.0
Return values
self

Search results