system/libraries/Cache.php

Class: Cache_Core

class Cache_Core

Provides a driver-based interface for finding, creating, and deleting cached resources. Caches are identified by a unique string. Tagging of caches is also supported, and caches can be found and deleted by id or tag.

Cache_Core -> __construct

public function __construct

Loads the configured driver and validates it.

Parameters:

array config
(array) custom configuration

Return: void


Cache_Core -> get

public function get

Fetches a cache by id. Non-string cache items are automatically unserialized before the cache is returned. NULL is returned when a cache item is not found.

Parameters:

string id
cache id

Return: mixed cached data or NULL


Cache_Core -> find

public function find

Fetches all of the caches for a given tag. An empty array will be returned when no matching caches are found.

Parameters:

string tag
cache tag

Return: array all cache items matching the tag


Cache_Core -> set

public function set

Set a cache item by id. Tags may also be added and a custom lifetime can be set. Non-string data is automatically serialized.

Parameters:

string id
unique cache id
mixed data
data to cache
array tags
(NULL) tags for this item
integer lifetime
(NULL) number of seconds until the cache expires

Return: bool


Cache_Core -> delete

public function delete

Delete a cache item by id.

Parameters:

string id
cache id

Return: bool


Cache_Core -> delete_tag

public function delete_tag

Delete all cache items with a given tag.

Parameters:

string tag
cache tag name

Return: bool


Cache_Core -> delete_all

public function delete_all

Delete ALL cache items items.

Return: bool