Class: MemcacheRedis

Provides a Memcache-compatible wrapper for the Redis PHP extension. For more info, see:

https://github.com/phpredis/phpredis

This allows you to use Redis as a drop-in replacement for Memcache as a cache store in Elefant.

To enable, edit the conf/config.php file and find the [Cache] section. Change the backend value to redis and add your Redis server info to the server[] setting in the same section.

Properties

public static $redis

Redis connection object.

private $servers_set = false

Methods

public __construct ($redis = false)

Constructor method receives or creates a new Redis object.

public setServers ($servers)

Set the server list directly. Used to handle full url-based connection strings with usernames and passwords. Note: Usernames require Redis 6.0+.

public addServer ($server, $port = 6379, $password = false)

Emulates Memcache::addServer via connect. Also adds serialization via PHP's serialize/unserialize functions.

public cache ($key, $timeout, $function)

Emulates MemcacheExt::cache.

public get ($key, $default_value = false)

Emulates Memcache::get.

public add ($key, $value, $flag = 0, $expire = false)

Emulates Memcache::add.

public set ($key, $value, $flag = 0, $expire = false)

Emulates Memcache::set via set and setex.

public replace ($key, $value, $flag = 0, $expire = false)

Emulates Memcache::replace via exists and set().

public delete ($key)

Emulates Memcache::delete.

public increment ($key, $value = 1)

Emulates Memcache::increment via incr and incrBy.

public decrement ($key, $value = 1)

Emulates Memcache::decrement via decr and decrBy.

public flush ()

Emulates Memcache::flush via flushDB.