Merge pull request #12544 from totten/master-redis-pool
[civicrm-core.git] / CRM / Core / PrevNextCache / Interface.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2018 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
13 | |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
18 | |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
26 */
27
28 /**
29 * Interface CRM_Core_PrevNextCache_Interface
30 *
31 * The previous/next cache is a service for tracking query results. Results
32 * are stored in a cache, and they may be individually toggled.
33 */
34 interface CRM_Core_PrevNextCache_Interface {
35
36 /**
37 * Store the results of a SQL query in the cache.
38 *
39 * @param string $cacheKey
40 * @param string $sql
41 * A SQL query. The query *MUST* be a SELECT statement which yields
42 * the following columns (in order): entity_table, entity_id1, entity_id2, cacheKey, data
43 * @return bool
44 */
45 public function fillWithSql($cacheKey, $sql);
46
47 /**
48 * Store the contents of an array in the cache.
49 *
50 * @param string $cacheKey
51 * @param array $rows
52 * A list of cache records. Each record should have keys:
53 * - entity_table
54 * - entity_id1
55 * - entity_id2
56 * - data
57 * @return bool
58 */
59 public function fillWithArray($cacheKey, $rows);
60
61 }