PHP Class CI_Cache, TastyIgniter

Author: EllisLab Dev Team
Inheritance: extends CI_Driver_Library
ファイルを表示 Open project: tastyigniter/tastyigniter Class Usage Examples

Public Properties

Property Type Description
$key_prefix string Cache key prefix

Protected Properties

Property Type Description
$_adapter mixed Reference to the driver
$_backup_driver string Fallback driver
$_cache_path string Path of cache files (if file-based cache)
$valid_drivers array Valid cache drivers

Public Methods

Method Description
__construct ( array $config = [] ) : void Constructor
cache_info ( string $type = 'user' ) : mixed Cache Info
clean ( ) : boolean Clean the cache
decrement ( string $id, integer $offset = 1 ) : mixed Decrement a raw value
delete ( string $id ) : boolean Delete from Cache
get ( string $id ) : mixed Get
get_metadata ( string $id ) : mixed Get Cache Metadata
increment ( string $id, integer $offset = 1 ) : mixed Increment a raw value
is_supported ( string $driver ) : array Is the requested driver supported in this environment?
save ( string $id, mixed $data, integer $ttl = 60, boolean $raw = FALSE ) : boolean Cache Save

Method Details

__construct() public method

Initialize class properties based on the configuration array.
public __construct ( array $config = [] ) : void
$config array = array()
return void

cache_info() public method

Cache Info
public cache_info ( string $type = 'user' ) : mixed
$type string = 'user' user/filehits
return mixed array containing cache info on success OR FALSE on failure

clean() public method

Clean the cache
public clean ( ) : boolean
return boolean TRUE on success, FALSE on failure

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 $id ) : boolean
$id string Cache ID
return boolean TRUE on success, FALSE on failure

get() public method

Look for a value in the cache. If it exists, return the data if not, return FALSE
public get ( string $id ) : mixed
$id string
return mixed value matching $id or FALSE on failure

get_metadata() public method

Get Cache Metadata
public get_metadata ( string $id ) : mixed
$id string key to get cache metadata on
return mixed cache item metadata

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

Is the requested driver supported in this environment?
public is_supported ( string $driver ) : array
$driver string The driver to test
return array

save() public method

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

Property Details

$_adapter protected_oe property

Reference to the driver
protected mixed $_adapter
return mixed

$_backup_driver protected_oe property

Fallback driver
protected string $_backup_driver
return string

$_cache_path protected_oe property

Path of cache files (if file-based cache)
protected string $_cache_path
return string

$key_prefix public_oe property

Cache key prefix
public string $key_prefix
return string

$valid_drivers protected_oe property

Valid cache drivers
protected array $valid_drivers
return array