class CRM_Core_PrevNextCache_Sql implements CRM_Core_PrevNextCache_Interface

Class CRM_Core_PrevNextCache_Sql

Store the previous/next cache in a special-purpose SQL table.

Constants

cacheDays

Methods

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.

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.

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

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

cleanup()

No description

Details

at line 55
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

Exceptions

CRM_Core_Exception

See also

CRM_Core_DAO::composeQuery

at line 66
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 96
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 152
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 185
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 230
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 252
int getCount(string $cacheKey)

Get count of matching rows.

Parameters

string $cacheKey

Return Value

int

at line 267
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 284
cleanup()