class redis extends memory

ACM for Redis

Compatible with the php extension phpredis available at https://github.com/nicolasff/phpredis

Properties

$vars from  base
$is_modified from  base
$sql_rowset from  base
$sql_row_pointer from  base
$cache_dir from  base
$key_prefix from  memory
$extension
$redis

Methods

null
purge()

Purge cache data

null
unload()

Unload cache object

int|bool
sql_load(string $query)

Load result of an SQL query from cache.

from  base
bool
sql_exists(int $query_id)

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

from  base
array|bool
sql_fetchrow(int $query_id)

Fetch row from cache (database)

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

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

from  base
bool
sql_rowseek(int $rownum, int $query_id)

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

from  base
bool
sql_freeresult(int $query_id)

Free memory used for a cached database result (database)

from  base
bool
remove_file(string $filename, bool $check = false)

Removes/unlinks file

from  base
null
remove_dir(string $dir)

Remove directory

from  base
int|string
clean_query_id(object|resource|int|string $query_id)

Ensure query ID can be used by cache

from  base
__construct()

Creates a redis cache driver.

mixed
load()

Load global cache

from  memory
null
save()

Save modified objects

from  memory
null
tidy()

Tidy cache

from  memory
mixed
get(string $var_name)

Get saved cache object

from  memory
null
put(string $var_name, mixed $var, int $ttl = 2592000)

Put data into cache

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

Destroy cache data

from  memory
bool
_exists(string $var_name)

Check if a given cache entry exists

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

Save result of an SQL query in cache.

from  memory
bool
_isset(string $var)

Check if a cache var exists

from  memory
mixed
_read(string $var)

Fetch an item from the cache

bool
_write(string $var, mixed $data, int $ttl = 2592000)

Store data in the cache

bool
_delete(string $var)

Remove an item from the cache

Details

at line 110
null purge()

Purge cache data

Return Value

null

at line 100
null unload()

Unload cache object

Return Value

null

in base at line 96
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.

in base at line 116
bool sql_exists(int $query_id)

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

Parameters

int $query_id

Return Value

bool

in base at line 125
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.

in base at line 139
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.

in base at line 153
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

in base at line 168
bool sql_freeresult(int $query_id)

Free memory used for a cached database result (database)

Parameters

int $query_id

Return Value

bool

in base at line 189
bool remove_file(string $filename, bool $check = false)

Removes/unlinks file

Parameters

string $filename

Filename to remove

bool $check

Check file permissions

Return Value

bool

True if the file was successfully removed, otherwise false

in base at line 209
protected null remove_dir(string $dir)

Remove directory

Parameters

string $dir

Directory to remove

Return Value

null

in base at line 243
int|string clean_query_id(object|resource|int|string $query_id)

Ensure query ID can be used by cache

Parameters

object|resource|int|string $query_id

Mixed type query id

Return Value

int|string

Query id in string or integer format

at line 51
__construct()

Creates a redis cache driver.

The following global constants affect operation:

PHPBB_ACM_REDIS_HOST PHPBB_ACM_REDIS_PORT PHPBB_ACM_REDIS_PASSWORD PHPBB_ACM_REDIS_DB

There are no publicly documented constructor parameters.

in memory at line 51
mixed load()

Load global cache

Return Value

mixed

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

in memory at line 68
null save()

Save modified objects

Return Value

null

in memory at line 83
null tidy()

Tidy cache

Return Value

null

in memory at line 94
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

in memory at line 114
null put(string $var_name, mixed $var, int $ttl = 2592000)

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

in memory at line 130
null destroy(string $var_name, string $table = '')

Destroy cache data

Parameters

string $var_name

Cache key

string $table

Table name

Return Value

null

in memory at line 184
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.

in memory at line 204
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.

in memory at line 277
protected bool _isset(string $var)

Check if a cache var exists

Parameters

string $var

Cache key

Return Value

bool

True if it exists, otherwise false

at line 124
protected mixed _read(string $var)

Fetch an item from the cache

Parameters

string $var

Cache key

Return Value

mixed

Cached data

at line 142
protected bool _write(string $var, mixed $data, int $ttl = 2592000)

Parameters

string $var

Cache key

mixed $data

Data to store

int $ttl

Time-to-live of cached data

Return Value

bool

True if the operation succeeded

at line 154
protected bool _delete(string $var)

Remove an item from the cache

Parameters

string $var

Cache key

Return Value

bool

True if the operation succeeded