class XcacheStorage extends CacheStorage

XCache cache storage handler

Properties

integer $_now Time that the cache storage handler was instantiated from CacheStorage
integer $_lifetime Cache lifetime from CacheStorage
boolean $_locking Flag if locking is enabled from CacheStorage
string $_language Language code from CacheStorage
string $_application Application name from CacheStorage
string $_hash Object hash from CacheStorage

Methods

__construct( array $options = array())

Constructor

static  CacheStorage
getInstance( string $handler = null, array $options = array())

Returns a cache storage handler object.

boolean
contains( string $id, string $group)

Check if the cache contains data stored by ID and group

mixed
get( string $id, string $group, boolean $checkTime = true)

Get cached data by ID and group

mixed
getAll()

Get all cached data

boolean
store( string $id, string $group, string $data)

Store the data to cache by ID and group

boolean
remove( string $id, string $group)

Remove a cached data entry by ID and group

boolean
clean( string $group, string $mode = null)

Clean cache for a group given a mode.

boolean
flush()

Flush all existing items in storage.

boolean
gc()

Garbage collect expired cache data

static  boolean
isSupported()

Test to see if the storage handler is available.

static  boolean
test()

Test to see if the storage handler is available.

mixed
lock( string $id, string $group, integer $locktime)

Lock cached item

boolean
unlock( string $id, string $group = null)

Unlock cached item

static  array
addIncludePath( array|string $path = '')

Add a directory where CacheStorage should search for handlers. You may either pass a string or an array of directories.

Details

__construct( array $options = array())

Constructor

Parameters

array $options Optional parameters

static CacheStorage getInstance( string $handler = null, array $options = array())

Returns a cache storage handler object.

Parameters

string $handler The cache storage handler to instantiate
array $options Array of handler options

Return Value

CacheStorage

Exceptions

UnexpectedValueException
UnsupportedCacheException

boolean contains( string $id, string $group)

Check if the cache contains data stored by ID and group

Parameters

string $id The cache data ID
string $group The cache data group

Return Value

boolean

mixed get( string $id, string $group, boolean $checkTime = true)

Get cached data by ID and group

Parameters

string $id The cache data ID
string $group The cache data group
boolean $checkTime True to verify cache time expiration threshold

Return Value

mixed Boolean false on failure or a cached data object

mixed getAll()

Get all cached data

Return Value

mixed Boolean false on failure or a cached data object

boolean store( string $id, string $group, string $data)

Store the data to cache by ID and group

Parameters

string $id The cache data ID
string $group The cache data group
string $data The data to store in cache

Return Value

boolean

boolean remove( string $id, string $group)

Remove a cached data entry by ID and group

Parameters

string $id The cache data ID
string $group The cache data group

Return Value

boolean

boolean clean( string $group, string $mode = null)

Clean cache for a group given a mode.

group mode : cleans all cache in the group notgroup mode : cleans all cache not in the group

Parameters

string $group The cache data group
string $mode The mode for cleaning cache [group|notgroup]

Return Value

boolean

boolean flush()

Flush all existing items in storage.

Return Value

boolean

boolean gc()

Garbage collect expired cache data

Return Value

boolean

static boolean isSupported()

Test to see if the storage handler is available.

Return Value

boolean

static boolean test()

Test to see if the storage handler is available.

Return Value

boolean

mixed lock( string $id, string $group, integer $locktime)

Lock cached item

Parameters

string $id The cache data ID
string $group The cache data group
integer $locktime Cached item max lock time

Return Value

mixed Boolean false if locking failed or an object containing properties lock and locklooped

boolean unlock( string $id, string $group = null)

Unlock cached item

Parameters

string $id The cache data ID
string $group The cache data group

Return Value

boolean

static array addIncludePath( array|string $path = '')

Add a directory where CacheStorage should search for handlers. You may either pass a string or an array of directories.

Parameters

array|string $path A path to search.

Return Value

array An array with directory elements