3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
13 * Interface CRM_Core_PrevNextCache_Interface
15 * The previous/next cache is a service for tracking query results. Results
16 * are stored in a cache, and they may be individually toggled.
18 interface CRM_Core_PrevNextCache_Interface
{
21 * Store the results of a SQL query in the cache.
23 * @param string $cacheKey
25 * A SQL query. The query *MUST* be a SELECT statement which yields
26 * the following columns (in order): cachekey, entity_id1, data
27 * @param array $sqlParams
28 * An array of parameters to be used with $sql.
29 * Use the same interpolation format as CRM_Core_DAO (composeQuery/executeQuery).
30 * Ex: [1 => ['foo', 'String']]
32 * @see CRM_Core_DAO::composeQuery
34 public function fillWithSql($cacheKey, $sql, $sqlParams = []);
37 * Store the contents of an array in the cache.
39 * @param string $cacheKey
41 * A list of cache records. Each record should have keys:
46 public function fillWithArray($cacheKey, $rows);
49 * Save checkbox selections.
51 * @param string $cacheKey
52 * @param string $action
53 * Ex: 'select', 'unselect'.
54 * @param array|int|null $ids
55 * A list of contact IDs to (un)select.
56 * To unselect all contact IDs, use NULL.
58 public function markSelection($cacheKey, $action, $ids = NULL);
63 * @param string $cacheKey
65 * @param string $action
66 * One of the following:
67 * - 'get' - get only selection records
68 * - 'getall' - get all the records of the specified cache key
72 public function getSelection($cacheKey, $action = 'get');
75 * Get the previous and next keys.
77 * @param string $cacheKey
84 * 'prev' => ['id1' => 123, 'data'=>'foo'],
85 * 'next' => ['id1' => 456, 'data'=>'foo'],
88 public function getPositions($cacheKey, $id1);
91 * Delete an item from the prevnext cache table based on the entity.
94 * @param string $cacheKey
96 public function deleteItem($id = NULL, $cacheKey = NULL);
99 * Get count of matching rows.
101 * @param string $cacheKey
104 public function getCount($cacheKey);
107 * Fetch a list of contacts from the prev/next cache for displaying a search results page
109 * @param string $cacheKey
111 * @param int $rowCount
113 * List of contact IDs (entity_id1).
115 public function fetch($cacheKey, $offset, $rowCount);
118 * Remove items from prev/next cache no longer current
120 public function cleanup();