CRM_Core_PrevNextCache_Interface
in
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.
Table of Contents
Methods
- cleanup() : mixed
- Remove items from prev/next cache no longer current
- deleteItem() : mixed
- Delete an item from the prevnext cache table based on the entity.
- fetch() : array<string|int, mixed>
- Fetch a list of contacts from the prev/next cache for displaying a search results page
- fillWithArray() : bool
- Store the contents of an array in the cache.
- fillWithSql() : bool
- Store the results of a SQL query in the cache.
- getCount() : int
- Get count of matching rows.
- getPositions() : array<string|int, mixed>
- Get the previous and next keys.
- getSelection() : array<string|int, mixed>|null
- Get the selections.
- markSelection() : mixed
- Save checkbox selections.
Methods
cleanup()
Remove items from prev/next cache no longer current
public
cleanup() : mixed
deleteItem()
Delete an item from the prevnext cache table based on the entity.
public
deleteItem([int $id = NULL ][, string $cacheKey = NULL ]) : mixed
Parameters
- $id : int = NULL
- $cacheKey : string = NULL
fetch()
Fetch a list of contacts from the prev/next cache for displaying a search results page
public
fetch(string $cacheKey, int $offset, int $rowCount) : array<string|int, mixed>
Parameters
- $cacheKey : string
- $offset : int
- $rowCount : int
Return values
array<string|int, mixed> —List of contact IDs (entity_id1).
fillWithArray()
Store the contents of an array in the cache.
public
fillWithArray(string $cacheKey, array<string|int, mixed> $rows) : bool
Parameters
- $cacheKey : string
- $rows : array<string|int, mixed>
-
A list of cache records. Each record should have keys:
- entity_id1
- data
Return values
boolfillWithSql()
Store the results of a SQL query in the cache.
public
fillWithSql(string $cacheKey, string $sql[, array<string|int, mixed> $sqlParams = [] ]) : bool
Parameters
- $cacheKey : string
- $sql : string
-
A SQL query. The query MUST be a SELECT statement which yields the following columns (in order): cachekey, entity_id1, data
- $sqlParams : array<string|int, mixed> = []
-
An array of parameters to be used with $sql. Use the same interpolation format as CRM_Core_DAO (composeQuery/executeQuery). Ex: [1 => ['foo', 'String']]
Tags
Return values
boolgetCount()
Get count of matching rows.
public
getCount(string $cacheKey) : int
Parameters
- $cacheKey : string
Return values
intgetPositions()
Get the previous and next keys.
public
getPositions(string $cacheKey, int $id1) : array<string|int, mixed>
Parameters
- $cacheKey : string
- $id1 : int
Return values
array<string|int, mixed> —List of neighbors. [ 'foundEntry' => 1, 'prev' => ['id1' => 123, 'data'=>'foo'], 'next' => ['id1' => 456, 'data'=>'foo'], ]
getSelection()
Get the selections.
public
getSelection(string $cacheKey[, string $action = 'get' ]) : array<string|int, mixed>|null
Parameters
- $cacheKey : string
-
Cache key.
- $action : string = 'get'
-
One of the following:
- 'get' - get only selection records
- 'getall' - get all the records of the specified cache key
Return values
array<string|int, mixed>|nullmarkSelection()
Save checkbox selections.
public
markSelection(string $cacheKey, string $action[, array<string|int, mixed>|int|null $ids = NULL ]) : mixed
Parameters
- $cacheKey : string
- $action : string
-
Ex: 'select', 'unselect'.
- $ids : array<string|int, mixed>|int|null = NULL
-
A list of contact IDs to (un)select. To unselect all contact IDs, use NULL.