PHP Class CI_Cache_redis, TastyIgniter

Author: Anton Lindqvist ([email protected])
Inheritance: extends CI_Driver
Show file Open project: tastyigniter/tastyigniter

Protected Properties

Property Type Description
$_default_config array Default config
$_redis Redis Redis connection
$_serialized array An internal cache for storing keys of serialized values.

Public Methods

Method Description
__construct ( ) : void Class constructor
__destruct ( ) : void Class destructor
cache_info ( string $type = NULL ) : array Get cache driver info
clean ( ) : boolean Clean cache
decrement ( string $id, integer $offset = 1 ) : mixed Decrement a raw value
delete ( string $key ) : boolean Delete from cache
get ( string $key ) : mixed Get cache
get_metadata ( string $key ) : array Get cache metadata
increment ( string $id, integer $offset = 1 ) : mixed Increment a raw value
is_supported ( ) : boolean Check if Redis driver is supported
save ( string $id, mixed $data, integer $ttl = 60, boolean $raw = FALSE ) : boolean Save cache

Method Details

__construct() public method

Setup Redis Loads Redis config file if present. Will halt execution if a Redis connection can't be established.
See also: Redis::connect()
public __construct ( ) : void
return void

__destruct() public method

Closes the connection to Redis if present.
public __destruct ( ) : void
return void

cache_info() public method

Get cache driver info
See also: Redis::info()
public cache_info ( string $type = NULL ) : array
$type string Not supported in Redis. Only included in order to offer a consistent cache API.
return array

clean() public method

Clean cache
See also: Redis::flushDB()
public clean ( ) : boolean
return boolean

decrement() public method

Decrement a raw value
public decrement ( string $id, integer $offset = 1 ) : mixed
$id string Cache ID
$offset integer Step/value to reduce by
return mixed New value on success or FALSE on failure

delete() public method

Delete from cache
public delete ( string $key ) : boolean
$key string Cache key
return boolean

get() public method

Get cache
public get ( string $key ) : mixed
$key string Cache ID
return mixed

get_metadata() public method

Get cache metadata
public get_metadata ( string $key ) : array
$key string Cache key
return array

increment() public method

Increment a raw value
public increment ( string $id, integer $offset = 1 ) : mixed
$id string Cache ID
$offset integer Step/value to add
return mixed New value on success or FALSE on failure

is_supported() public method

Check if Redis driver is supported
public is_supported ( ) : boolean
return boolean

save() public method

Save cache
public save ( string $id, mixed $data, integer $ttl = 60, boolean $raw = FALSE ) : boolean
$id string Cache ID
$data mixed Data to save
$ttl integer Time to live in seconds
$raw boolean Whether to store the raw value (unused)
return boolean TRUE on success, FALSE on failure

Property Details

$_default_config protected static property

Default config
protected static array $_default_config
return array

$_redis protected property

Redis connection
protected Redis $_redis
return Redis

$_serialized protected property

An internal cache for storing keys of serialized values.
protected array $_serialized
return array