Documentation

Mem
in package

Memcached function encapsulator class.

Table of Contents

Properties

$instance  : Memcached
Static variable to ensure singleton mechanism.

Methods

Create()  : Memcached|null
Creates a singleton Memcached object.
Delete()  : bool
Deletes a variable from the cache.
Dispose()  : void
Closes the Memcached connection.
Exists()  : bool
Checks the existence of a variable in the cache.
List()  : array<string|int, mixed>
Lists keys stored in the cache.
Read()  : mixed|false
Reads a variable from the cache.
Write()  : bool
Writes a variable to the cache.
ZWrite()  : bool
Writes a variable to the cache in compressed form.

Properties

$instance

Static variable to ensure singleton mechanism.

public static Memcached $instance

Methods

Create()

Creates a singleton Memcached object.

public static Create(string $host, int $port) : Memcached|null
Parameters
$host : string

The Memcached host

$port : int

The Memcached port

Return values
Memcached|null

The Memcached object or null if the class does not exist

Delete()

Deletes a variable from the cache.

public static Delete(string $name) : bool
Parameters
$name : string

The name of the variable

Return values
bool

True if the operation was successful, otherwise false

Dispose()

Closes the Memcached connection.

public static Dispose() : void

Exists()

Checks the existence of a variable in the cache.

public static Exists(string $name) : bool
Parameters
$name : string

The name of the variable

Return values
bool

True if the variable exists in the cache, otherwise false

List()

Lists keys stored in the cache.

public static List([string|null $filter = null ]) : array<string|int, mixed>
Parameters
$filter : string|null = null

The filter pattern to match keys against

Return values
array<string|int, mixed>

An array of keys stored in the cache

Read()

Reads a variable from the cache.

public static Read(string $name) : mixed|false
Parameters
$name : string

The name of the variable

Return values
mixed|false

The data of the variable, or false if the variable does not exist in the cache

Write()

Writes a variable to the cache.

public static Write(string $name, mixed $value[, int $livetime = 600 ]) : bool
Parameters
$name : string

The name of the variable

$value : mixed

The data

$livetime : int = 600

The lifetime of the variable in seconds

Return values
bool

True if the operation was successful, otherwise false

ZWrite()

Writes a variable to the cache in compressed form.

public static ZWrite(string $name, mixed $value[, int $livetime = 600 ]) : bool
Parameters
$name : string

The name of the variable

$value : mixed

The data

$livetime : int = 600

The lifetime of the variable in seconds

Return values
bool

True if the operation was successful, otherwise false


        
On this page

Search results