interface CRM_Core_PrevNextCache_Interface

Interface CRM_Core_PrevNextCache_Interface

The previous/next cache is a service for tracking query results. Results are stored in a cache, and they may be individually toggled.

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()

Remove items from prev/next cache no longer current

Details

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

See also

CRM_Core_DAO::composeQuery

at line 62
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 74
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 88
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 104
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 112
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 120
int getCount(string $cacheKey)

Get count of matching rows.

Parameters

string $cacheKey

Return Value

int

at line 131
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 136
cleanup()

Remove items from prev/next cache no longer current