Constants

KEYS_NAME

KEYS_NAME

Name of keys index

SQL_TABLES_NAME

SQL_TABLES_NAME

Name of SQL cache index

Properties

$instance

$instance : \Cache

Type

\Cache

$keys

$keys : array

Type

array — List all keys of cached data and their associated ttl

$sql_tables_cached

$sql_tables_cached : array

Type

array — Store list of tables and their associated keys for SQL cache (warning: this var must not be initialized here !)

$blacklist

$blacklist : array

Type

array — List of blacklisted tables for SQL cache, these tables won't be indexed

$local

$local : array

Type

array — Store local cache

Methods

flush()

flush() : boolean

Clean all cached data

Returns

boolean

getInstance()

getInstance() : \Cache

Returns

\Cache

set()

set(string  $key, mixed  $value, integer  $ttl) : boolean

Store a data in cache

Parameters

string $key
mixed $value
integer $ttl

Returns

boolean

get()

get(string  $key) : mixed

Retrieve a data from cache

Parameters

string $key

Returns

mixed

exists()

exists(string  $key) : boolean

Check if a data is cached

Parameters

string $key

Returns

boolean

delete()

delete(string  $key) : array

Delete one or several data from cache (* joker can be used) E.g.: delete('*'); delete('my_prefix_*'); delete('my_key_name');

Parameters

string $key

Returns

array —

List of deleted keys

setQuery()

setQuery(string  $query, array  $result) 

Store a query in cache

Parameters

string $query
array $result

deleteQuery()

deleteQuery(string  $query) 

Delete a query from cache

Parameters

string $query

store()

store(  $key,   $value) 

Parameters

$key
$value

retrieve()

retrieve(  $key) 

Parameters

$key

retrieveAll()

retrieveAll() 

isStored()

isStored(  $key) 

Parameters

$key

clean()

clean(  $key) 

Parameters

$key

_set()

_set(string  $key, mixed  $value, integer  $ttl) : boolean

Cache a data

Parameters

string $key
mixed $value
integer $ttl

Returns

boolean

_get()

_get(string  $key) : mixed

Retrieve a cached data by key

Parameters

string $key

Returns

mixed

_exists()

_exists(string  $key) : boolean

Check if a data is cached by key

Parameters

string $key

Returns

boolean

_delete()

_delete(string  $key) : boolean

Delete a data from the cache by key

Parameters

string $key

Returns

boolean

_writeKeys()

_writeKeys() 

Write keys index

getTables()

getTables(  $string) 

Parameters

$string

isBlacklist()

isBlacklist(string  $query) : boolean

Check if a query contain blacklisted tables

Parameters

string $query

Returns

boolean