5 * @copyright CiviCRM LLC https://civicrm.org/licensing
7 * Generated from xml/schema/CRM/Core/Cache.xml
8 * DO NOT EDIT. Generated by CRM_Core_CodeGen
9 * (GenCodeChecksum:2639f5b19898adf08f19b9f2713d5e76)
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;
39 * group name for cache element, useful in cleaning cache elements
46 * Unique path name for cache element
53 * data associated with this path
60 * Component that this menu item belongs to
67 * When was the cache item created
74 * When should the cache item expire
83 public function __construct() {
84 $this->__table
= 'civicrm_cache';
85 parent
::__construct();
89 * Returns foreign keys and entity references.
92 * [CRM_Core_Reference_Interface]
94 public static function getReferenceColumns() {
95 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
96 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
97 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
98 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
100 return Civi
::$statics[__CLASS__
]['links'];
104 * Returns all the column names of this table
108 public static function &fields() {
109 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
110 Civi
::$statics[__CLASS__
]['fields'] = [
113 'type' => CRM_Utils_Type
::T_INT
,
114 'title' => ts('Cache ID'),
115 'description' => ts('Unique table ID'),
117 'where' => 'civicrm_cache.id',
118 'table_name' => 'civicrm_cache',
120 'bao' => 'CRM_Core_BAO_Cache',
124 'name' => 'group_name',
125 'type' => CRM_Utils_Type
::T_STRING
,
126 'title' => ts('Group Name'),
127 'description' => ts('group name for cache element, useful in cleaning cache elements'),
130 'size' => CRM_Utils_Type
::MEDIUM
,
131 'where' => 'civicrm_cache.group_name',
132 'table_name' => 'civicrm_cache',
134 'bao' => 'CRM_Core_BAO_Cache',
139 'type' => CRM_Utils_Type
::T_STRING
,
140 'title' => ts('Path'),
141 'description' => ts('Unique path name for cache element'),
143 'size' => CRM_Utils_Type
::HUGE
,
144 'where' => 'civicrm_cache.path',
145 'table_name' => 'civicrm_cache',
147 'bao' => 'CRM_Core_BAO_Cache',
152 'type' => CRM_Utils_Type
::T_LONGTEXT
,
153 'title' => ts('Data'),
154 'description' => ts('data associated with this path'),
155 'where' => 'civicrm_cache.data',
156 'table_name' => 'civicrm_cache',
158 'bao' => 'CRM_Core_BAO_Cache',
162 'name' => 'component_id',
163 'type' => CRM_Utils_Type
::T_INT
,
164 'title' => ts('Component ID'),
165 'description' => ts('Component that this menu item belongs to'),
166 'where' => 'civicrm_cache.component_id',
167 'table_name' => 'civicrm_cache',
169 'bao' => 'CRM_Core_BAO_Cache',
171 'FKClassName' => 'CRM_Core_DAO_Component',
175 'pseudoconstant' => [
176 'table' => 'civicrm_component',
178 'labelColumn' => 'name',
182 'name' => 'created_date',
183 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
184 'title' => ts('Created Date'),
185 'description' => ts('When was the cache item created'),
186 'where' => 'civicrm_cache.created_date',
187 'default' => 'CURRENT_TIMESTAMP',
188 'table_name' => 'civicrm_cache',
190 'bao' => 'CRM_Core_BAO_Cache',
194 'name' => 'expired_date',
195 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
196 'title' => ts('Expired Date'),
197 'description' => ts('When should the cache item expire'),
199 'where' => 'civicrm_cache.expired_date',
201 'table_name' => 'civicrm_cache',
203 'bao' => 'CRM_Core_BAO_Cache',
207 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
209 return Civi
::$statics[__CLASS__
]['fields'];
213 * Return a mapping from field-name to the corresponding key (as used in fields()).
216 * Array(string $name => string $uniqueName).
218 public static function &fieldKeys() {
219 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
220 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
222 return Civi
::$statics[__CLASS__
]['fieldKeys'];
226 * Returns the names of this table
230 public static function getTableName() {
231 return self
::$_tableName;
235 * Returns if this table needs to be logged
239 public function getLog() {
244 * Returns the list of fields that can be imported
246 * @param bool $prefix
250 public static function &import($prefix = FALSE) {
251 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cache', $prefix, []);
256 * Returns the list of fields that can be exported
258 * @param bool $prefix
262 public static function &export($prefix = FALSE) {
263 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cache', $prefix, []);
268 * Returns the list of indices
270 * @param bool $localize
274 public static function indices($localize = TRUE) {
276 'UI_group_path_date' => [
277 'name' => 'UI_group_path_date',
283 'localizable' => FALSE,
285 'sig' => 'civicrm_cache::1::group_name::path::created_date',
288 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;