class CRM_Core_PrevNextCache_Redis implements CRM_Core_PrevNextCache_Interface

Class CRM_Core_PrevNextCache_Memory

Store the previous/next cache in a Redis set.

Each logical prev-next cache corresponds to three distinct items in Redis: - "{prefix}/{qfKey}/list" - Sorted set of entity_id, with all entities - "{prefix}/{qfkey}/sel" - Sorted set of entity_id, with only entities marked by user - "{prefix}/{qfkey}/data" - Hash mapping from entity_id to data

Constants

TTL

Properties

protected Redis $redis
protected string $prefix

Methods

__construct(array $settings)

CRM_Core_PrevNextCache_Redis constructor.

bool
fillWithSql(string $cacheKey, string $sql, array $sqlParams = [])

Store the results of a SQL query in the cache.

bool
fillWithArray(string $cacheKey, array $rows)

Store the contents of an array in the cache.

array
fetch(string $cacheKey, int $offset, int $rowCount)

Fetch a list of contacts from the prev/next cache for displaying a search results page

markSelection(string $cacheKey, string $action, array|int|null $ids = NULL)

Save checkbox selections.

array|NULL
getSelection(string $cacheKey, string $action = 'get')

Get the selections.

array
getPositions(string $cacheKey, int $id1)

Get the previous and next keys.

deleteItem(int $id = NULL, string $cacheKey = NULL)

Delete an item from the prevnext cache table based on the entity.

int
getCount(string $cacheKey)

Get count of matching rows.

cleanup()

No description

Details

at line 58
__construct(array $settings)

CRM_Core_PrevNextCache_Redis constructor.

Parameters

array $settings

at line 64
bool fillWithSql(string $cacheKey, string $sql, array $sqlParams = [])

Store the results of a SQL query in the cache.

Parameters

string $cacheKey
string $sql A SQL query. The query MUST be a SELECT statement which yields the following columns (in order): cachekey, entity_id1, data
array $sqlParams An array of parameters to be used with $sql. Use the same interpolation format as CRM_Core_DAO (composeQuery/executeQuery). Ex: [1 => ['foo', 'String']]

Return Value

bool

at line 82
bool fillWithArray(string $cacheKey, array $rows)

Store the contents of an array in the cache.

Parameters

string $cacheKey
array $rows A list of cache records. Each record should have keys: - entity_id1 - data

Return Value

bool

at line 94
array fetch(string $cacheKey, int $offset, int $rowCount)

Fetch a list of contacts from the prev/next cache for displaying a search results page

Parameters

string $cacheKey
int $offset
int $rowCount

Return Value

array List of contact IDs (entity_id1).

at line 99
markSelection(string $cacheKey, string $action, array|int|null $ids = NULL)

Save checkbox selections.

Parameters

string $cacheKey
string $action Ex: 'select', 'unselect'.
array|int|null $ids A list of contact IDs to (un)select. To unselect all contact IDs, use NULL.

at line 120
array|NULL getSelection(string $cacheKey, string $action = 'get')

Get the selections.

Parameters

string $cacheKey Cache key.
string $action One of the following: - 'get' - get only selection records - 'getall' - get all the records of the specified cache key

Return Value

array|NULL

at line 143
array getPositions(string $cacheKey, int $id1)

Get the previous and next keys.

Parameters

string $cacheKey
int $id1

Return Value

array List of neighbors. [ 'foundEntry' => 1, 'prev' => ['id1' => 123, 'data'=>'foo'], 'next' => ['id1' => 456, 'data'=>'foo'], ]

at line 174
deleteItem(int $id = NULL, string $cacheKey = NULL)

Delete an item from the prevnext cache table based on the entity.

Parameters

int $id
string $cacheKey

at line 208
int getCount(string $cacheKey)

Get count of matching rows.

Parameters

string $cacheKey

Return Value

int

at line 258
cleanup()