interface driver_interface

An interface that all cache drivers must implement

Methods

mixed
load()

Load global cache

null
unload()

Unload cache object

null
save()

Save modified objects

null
tidy()

Tidy cache

mixed
get(string $var_name)

Get saved cache object

null
put(string $var_name, mixed $var, int $ttl = 0)

Put data into cache

null
purge()

Purge cache data

null
destroy(string $var_name, string $table = '')

Destroy cache data

bool
_exists(string $var_name)

Check if a given cache entry exists

int|bool
sql_load(string $query)

Load result of an SQL query from cache.

int|mixed
sql_save(driver_interface $db, string $query, mixed $query_result, int $ttl)

Save result of an SQL query in cache.

bool
sql_exists(int $query_id)

Check if result for a given SQL query exists in cache.

array|bool
sql_fetchrow(int $query_id)

Fetch row from cache (database)

string|bool
sql_fetchfield(int $query_id, string $field)

Fetch a field from the current row of a cached database result (database)

bool
sql_rowseek(int $rownum, int $query_id)

Seek a specific row in an a cached database result (database)

bool
sql_freeresult(int $query_id)

Free memory used for a cached database result (database)

Details

at line 26
mixed load()

Load global cache

Return Value

mixed

False if an error was encountered, otherwise the data type of the cached data

at line 33
null unload()

Unload cache object

Return Value

null

at line 40
null save()

Save modified objects

Return Value

null

at line 47
null tidy()

Tidy cache

Return Value

null

at line 55
mixed get(string $var_name)

Get saved cache object

Parameters

string $var_name

Cache key

Return Value

mixed

False if an error was encountered, otherwise the saved cached object

at line 65
null put(string $var_name, mixed $var, int $ttl = 0)

Put data into cache

Parameters

string $var_name

Cache key

mixed $var

Cached data to store

int $ttl

Time-to-live of cached data

Return Value

null

at line 72
null purge()

Purge cache data

Return Value

null

at line 81
null destroy(string $var_name, string $table = '')

Destroy cache data

Parameters

string $var_name

Cache key

string $table

Table name

Return Value

null

at line 91
bool _exists(string $var_name)

Check if a given cache entry exists

Parameters

string $var_name

Cache key

Return Value

bool

True if cache file exists and has not expired. False otherwise.

at line 102
int|bool sql_load(string $query)

Load result of an SQL query from cache.

Parameters

string $query

SQL query

Return Value

int|bool

Query ID (integer) if cache contains a rowset for the specified query. False otherwise.

at line 122
int|mixed sql_save(driver_interface $db, string $query, mixed $query_result, int $ttl)

Save result of an SQL query in cache.

In persistent cache stores, this function stores the query result to persistent storage. In other words, there is no need to call save() afterwards.

Parameters

driver_interface $db

Database connection

string $query

SQL query, should be used for generating storage key

mixed $query_result

The result from \dbal::sql_query, to be passed to \dbal::sql_fetchrow to get all rows and store them in cache.

int $ttl

Time to live, after this timeout the query should expire from the cache.

Return Value

int|mixed

If storing in cache succeeded, an integer $query_id representing the query should be returned. Otherwise the original $query_result should be returned.

at line 130
bool sql_exists(int $query_id)

Check if result for a given SQL query exists in cache.

Parameters

int $query_id

Return Value

bool

at line 139
array|bool sql_fetchrow(int $query_id)

Fetch row from cache (database)

Parameters

int $query_id

Return Value

array|bool

The query result if found in the cache, otherwise false.

at line 149
string|bool sql_fetchfield(int $query_id, string $field)

Fetch a field from the current row of a cached database result (database)

Parameters

int $query_id
string $field

The name of the column.

Return Value

string|bool

The field of the query result if found in the cache, otherwise false.

at line 158
bool sql_rowseek(int $rownum, int $query_id)

Seek a specific row in an a cached database result (database)

Parameters

int $rownum

Row to seek to.

int $query_id

Return Value

bool

at line 166
bool sql_freeresult(int $query_id)

Free memory used for a cached database result (database)

Parameters

int $query_id

Return Value

bool