5 * @copyright CiviCRM LLC (c) 2004-2019
7 * Generated from xml/schema/CRM/Core/Cache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:0683b150dd60e1ec9b53c00957137a27)
13 * Database access object for the Cache entity.
15 class CRM_Core_DAO_Cache
extends CRM_Core_DAO
{
18 * Static instance to hold the table name.
22 public static $_tableName = 'civicrm_cache';
25 * Should CiviCRM log any modifications to this table in the civicrm_log table.
29 public static $_log = FALSE;
37 * group name for cache element, useful in cleaning cache elements
44 * Unique path name for cache element
51 * data associated with this path
58 * Component that this menu item belongs to
65 * When was the cache item created
72 * When should the cache item expire
81 public function __construct() {
82 $this->__table
= 'civicrm_cache';
83 parent
::__construct();
87 * Returns foreign keys and entity references.
90 * [CRM_Core_Reference_Interface]
92 public static function getReferenceColumns() {
93 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
94 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
95 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
96 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
98 return Civi
::$statics[__CLASS__
]['links'];
102 * Returns all the column names of this table
106 public static function &fields() {
107 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
108 Civi
::$statics[__CLASS__
]['fields'] = [
111 'type' => CRM_Utils_Type
::T_INT
,
113 'where' => 'civicrm_cache.id',
114 'table_name' => 'civicrm_cache',
116 'bao' => 'CRM_Core_BAO_Cache',
120 'name' => 'group_name',
121 'type' => CRM_Utils_Type
::T_STRING
,
122 'title' => ts('Group Name'),
123 'description' => ts('group name for cache element, useful in cleaning cache elements'),
126 'size' => CRM_Utils_Type
::MEDIUM
,
127 'where' => 'civicrm_cache.group_name',
128 'table_name' => 'civicrm_cache',
130 'bao' => 'CRM_Core_BAO_Cache',
135 'type' => CRM_Utils_Type
::T_STRING
,
136 'title' => ts('Path'),
137 'description' => ts('Unique path name for cache element'),
139 'size' => CRM_Utils_Type
::HUGE
,
140 'where' => 'civicrm_cache.path',
141 'table_name' => 'civicrm_cache',
143 'bao' => 'CRM_Core_BAO_Cache',
148 'type' => CRM_Utils_Type
::T_LONGTEXT
,
149 'title' => ts('Data'),
150 'description' => ts('data associated with this path'),
151 'where' => 'civicrm_cache.data',
152 'table_name' => 'civicrm_cache',
154 'bao' => 'CRM_Core_BAO_Cache',
158 'name' => 'component_id',
159 'type' => CRM_Utils_Type
::T_INT
,
160 'description' => ts('Component that this menu item belongs to'),
161 'where' => 'civicrm_cache.component_id',
162 'table_name' => 'civicrm_cache',
164 'bao' => 'CRM_Core_BAO_Cache',
166 'FKClassName' => 'CRM_Core_DAO_Component',
170 'pseudoconstant' => [
171 'table' => 'civicrm_component',
173 'labelColumn' => 'name',
177 'name' => 'created_date',
178 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
179 'title' => ts('Created Date'),
180 'description' => ts('When was the cache item created'),
181 'where' => 'civicrm_cache.created_date',
182 'default' => 'CURRENT_TIMESTAMP',
183 'table_name' => 'civicrm_cache',
185 'bao' => 'CRM_Core_BAO_Cache',
189 'name' => 'expired_date',
190 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
191 'title' => ts('Expired Date'),
192 'description' => ts('When should the cache item expire'),
194 'where' => 'civicrm_cache.expired_date',
196 'table_name' => 'civicrm_cache',
198 'bao' => 'CRM_Core_BAO_Cache',
202 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
204 return Civi
::$statics[__CLASS__
]['fields'];
208 * Return a mapping from field-name to the corresponding key (as used in fields()).
211 * Array(string $name => string $uniqueName).
213 public static function &fieldKeys() {
214 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
215 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
217 return Civi
::$statics[__CLASS__
]['fieldKeys'];
221 * Returns the names of this table
225 public static function getTableName() {
226 return self
::$_tableName;
230 * Returns if this table needs to be logged
234 public function getLog() {
239 * Returns the list of fields that can be imported
241 * @param bool $prefix
245 public static function &import($prefix = FALSE) {
246 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cache', $prefix, []);
251 * Returns the list of fields that can be exported
253 * @param bool $prefix
257 public static function &export($prefix = FALSE) {
258 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cache', $prefix, []);
263 * Returns the list of indices
265 * @param bool $localize
269 public static function indices($localize = TRUE) {
271 'UI_group_path_date' => [
272 'name' => 'UI_group_path_date',
278 'localizable' => FALSE,
280 'sig' => 'civicrm_cache::1::group_name::path::created_date',
283 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;