Documentation

Cache_Static extends Core_Cache
in package

Static 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
$_maxLen  : mixed
Max lenght file or directory name
$_path  : string
Cache path

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
Clear static 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
insert()  : mixed
Put content into cache
instance()  : object
Register an existing instance as a singleton.
set()  : self
Set data in cache
uriSatisfyRequirements()  : mixed
Check if $uri satisfy $requirements
_deleteByTag()  : self
Delete cache items by $oCache_Tag
_deleteDir()  : selfs
Rename and delete dir
_getPath()  : array<string|int, mixed>
Prepare cache_dir, sQuery and sQueryEncode
_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*'

$_maxLen

Max lenght file or directory name

protected mixed $_maxLen = 200

$_path

Cache path

protected string $_path = \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()

Clear static cache

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

site

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

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

insert()

Put content into cache

public insert(string $uri, string $content) : mixed
Parameters
$uri : string

URI

$content : string

content

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()
Return values
self

uriSatisfyRequirements()

Check if $uri satisfy $requirements

public uriSatisfyRequirements(string $uri, string $requirements) : mixed
Parameters
$uri : string

URI

$requirements : string

Requirements separated with "\n"

Tags
see
site_model::uriSatisfyRequirements

_deleteDir()

Rename and delete dir

protected _deleteDir(string $dirName) : selfs
Parameters
$dirName : string

Dirname in the $this->_path

Return values
selfs

_getPath()

Prepare cache_dir, sQuery and sQueryEncode

protected _getPath(string $uri) : array<string|int, mixed>
Parameters
$uri : string

URI

Return values
array<string|int, mixed>

_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