Documentation

Cache_XCache extends Core_Cache
in package

XCache cache driver

Tags
subpackage

Cache

version
7.x
author

Hostmake LLC

copyright

© 2005-2024 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

Properties

$aCaches  : mixed
Typical cache parameters
$instance  : array<string|int, mixed>
The singleton instances.
$_cleaningFrequency  : int
Cleaning Cache Tags Frequency
$_config  : mixed
Driver's configuration
$_format  : string
Pack format
$_prefix  : string
Prefix of the cache name

Methods

__construct()  : mixed
Constructor.
available()  : bool
check cache available
check()  : null|true|false
Check if data exists
clearTags()  : self
Clear all tags for $cacheName
delete()  : self
Delete key from cache
deleteAll()  : self
Delete all keys from cache
deleteByTag()  : self
Delete cache items by tag
deleteTags()  : self
Delete Cache_Tags
get()  : mixed
Get data from cache
getCachesList()  : array<string|int, mixed>
Get list of caches
getCount()  : int
Get a count of keys in cache $cacheName
getKey()  : string
Get key by array of $object's properties $aVars
instance()  : object
Register an existing instance as a singleton.
set()  : self
Set data in cache
_delete()  : self
Delete key from cache
_deleteByTag()  : self
Delete cache items by $oCache_Tag
_getActualKey()  : mixed
Get unique cache name key
_issetCacheConfig()  : bool
Check cache config isset
_pack()  : string
Serialize and add packed checksum
_saveTags()  : self
Save array of tags into table
_unPack()  : string
Unserialize and check checksum

Properties

$aCaches

Typical cache parameters

public static mixed $aCaches = array('expire' => 86400, 'size' => 262144, 'active' => \TRUE, 'tags' => \TRUE, 'compress' => \FALSE)

$instance

The singleton instances.

public static array<string|int, mixed> $instance = array()

$_cleaningFrequency

Cleaning Cache Tags Frequency

protected int $_cleaningFrequency = 5000

$_config

Driver's configuration

protected mixed $_config = \NULL

$_format

Pack format

protected string $_format = 'i*'

$_prefix

Prefix of the cache name

protected string $_prefix = \NULL

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $config) : mixed
Parameters
$config : array<string|int, mixed>

Driver's configuration

available()

check cache available

public available() : bool
Return values
bool

check()

Check if data exists

public check(string $key[, string $cacheName = 'default' ]) : null|true|false
Parameters
$key : string

key name

$cacheName : string = 'default'

cache name

Return values
null|true|false

clearTags()

Clear all tags for $cacheName

public clearTags(string $cacheName) : self
Parameters
$cacheName : string

cache name

Return values
self

delete()

Delete key from cache

public delete(string $key[, string $cacheName = 'default' ]) : self
Parameters
$key : string

key name

$cacheName : string = 'default'

cache name

Return values
self

deleteAll()

Delete all keys from cache

public deleteAll([string $cacheName = 'default' ]) : self
Parameters
$cacheName : string = 'default'

cache name

Return values
self

deleteByTag()

Delete cache items by tag

public deleteByTag(string $tag) : self
Parameters
$tag : string
Return values
self

deleteTags()

Delete Cache_Tags

public deleteTags(string $actualKey) : self
Parameters
$actualKey : string

cache key

Return values
self

get()

Get data from cache

public get(string $key[, string $cacheName = 'default' ][, string $defaultValue = NULL ]) : mixed
Parameters
$key : string

key name

$cacheName : string = 'default'

cache name

$defaultValue : string = NULL

default value if index does not exist

Tags
hostcms-event

Core_Cache.onBeforeGet

hostcms-event

Core_Cache.onAfterGet

getCachesList()

Get list of caches

public getCachesList() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCount()

Get a count of keys in cache $cacheName

public getCount([string $cacheName = 'default' ]) : int
Parameters
$cacheName : string = 'default'

cache name

Return values
int

getKey()

Get key by array of $object's properties $aVars

public getKey(array<string|int, mixed> $aVars, object $object) : string
Parameters
$aVars : array<string|int, mixed>

array of properties

$object : object

object

Return values
string

instance()

Register an existing instance as a singleton.

public static instance([string $name = 'default' ]) : object
Parameters
$name : string = 'default'
Return values
object

set()

Set data in cache

public set(string $key, mixed $value[, string $cacheName = 'default' ][, array<string|int, mixed> $tags = array() ]) : self
Parameters
$key : string

key name

$value : mixed

value

$cacheName : string = 'default'

cache name

$tags : array<string|int, mixed> = array()
Tags
hostcms-event

Core_Cache.onBeforeSet

hostcms-event

Core_Cache.onAfterSet

Return values
self

_delete()

Delete key from cache

protected _delete(string $hash) : self
Parameters
$hash : string

cache index

Return values
self

_getActualKey()

Get unique cache name key

protected _getActualKey(string $cacheName[, string $key = NULL ]) : mixed
Parameters
$cacheName : string

cache name

$key : string = NULL

key name

_issetCacheConfig()

Check cache config isset

protected _issetCacheConfig(string $cacheName) : bool
Parameters
$cacheName : string
Return values
bool

_pack()

Serialize and add packed checksum

protected _pack(string $value) : string
Parameters
$value : string

value

Return values
string

_saveTags()

Save array of tags into table

protected _saveTags(mixed $cacheName, string $actualKey, array<string|int, mixed> $tags, mixed $expire) : self
Parameters
$cacheName : mixed
$actualKey : string

cache key

$tags : array<string|int, mixed>

array of tags

$expire : mixed
Return values
self

_unPack()

Unserialize and check checksum

protected _unPack(string $value) : string
Parameters
$value : string

value

Return values
string

        
On this page

Search results