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:da6b1275fea0ffb19d09613211f7628e)
13 * Database access object for the Cache entity.
15 class CRM_Core_DAO_Cache
extends CRM_Core_DAO
{
16 const EXT
= 'civicrm';
17 const TABLE_ADDED
= '2.1';
20 * Static instance to hold the table name.
24 public static $_tableName = 'civicrm_cache';
27 * Should CiviCRM log any modifications to this table in the civicrm_log table.
31 public static $_log = FALSE;
41 * group name for cache element, useful in cleaning cache elements
48 * Unique path name for cache element
55 * data associated with this path
62 * Component that this menu item belongs to
69 * When was the cache item created
76 * When should the cache item expire
85 public function __construct() {
86 $this->__table
= 'civicrm_cache';
87 parent
::__construct();
91 * Returns localized title of this entity.
94 * Whether to return the plural version of the title.
96 public static function getEntityTitle($plural = FALSE) {
97 return $plural ?
ts('Caches') : ts('Cache');
101 * Returns foreign keys and entity references.
104 * [CRM_Core_Reference_Interface]
106 public static function getReferenceColumns() {
107 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
108 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
109 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
110 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
112 return Civi
::$statics[__CLASS__
]['links'];
116 * Returns all the column names of this table
120 public static function &fields() {
121 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
122 Civi
::$statics[__CLASS__
]['fields'] = [
125 'type' => CRM_Utils_Type
::T_INT
,
126 'title' => ts('Cache ID'),
127 'description' => ts('Unique table ID'),
129 'where' => 'civicrm_cache.id',
130 'table_name' => 'civicrm_cache',
132 'bao' => 'CRM_Core_BAO_Cache',
141 'name' => 'group_name',
142 'type' => CRM_Utils_Type
::T_STRING
,
143 'title' => ts('Group Name'),
144 'description' => ts('group name for cache element, useful in cleaning cache elements'),
147 'size' => CRM_Utils_Type
::MEDIUM
,
148 'where' => 'civicrm_cache.group_name',
149 'table_name' => 'civicrm_cache',
151 'bao' => 'CRM_Core_BAO_Cache',
157 'type' => CRM_Utils_Type
::T_STRING
,
158 'title' => ts('Path'),
159 'description' => ts('Unique path name for cache element'),
161 'size' => CRM_Utils_Type
::HUGE
,
162 'where' => 'civicrm_cache.path',
163 'table_name' => 'civicrm_cache',
165 'bao' => 'CRM_Core_BAO_Cache',
171 'type' => CRM_Utils_Type
::T_LONGTEXT
,
172 'title' => ts('Data'),
173 'description' => ts('data associated with this path'),
174 'where' => 'civicrm_cache.data',
175 'table_name' => 'civicrm_cache',
177 'bao' => 'CRM_Core_BAO_Cache',
182 'name' => 'component_id',
183 'type' => CRM_Utils_Type
::T_INT
,
184 'title' => ts('Component ID'),
185 'description' => ts('Component that this menu item belongs to'),
186 'where' => 'civicrm_cache.component_id',
187 'table_name' => 'civicrm_cache',
189 'bao' => 'CRM_Core_BAO_Cache',
191 'FKClassName' => 'CRM_Core_DAO_Component',
194 'label' => ts("Component"),
196 'pseudoconstant' => [
197 'table' => 'civicrm_component',
199 'labelColumn' => 'name',
204 'name' => 'created_date',
205 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
206 'title' => ts('Created Date'),
207 'description' => ts('When was the cache item created'),
208 'where' => 'civicrm_cache.created_date',
209 'default' => 'CURRENT_TIMESTAMP',
210 'table_name' => 'civicrm_cache',
212 'bao' => 'CRM_Core_BAO_Cache',
217 'name' => 'expired_date',
218 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
219 'title' => ts('Expired Date'),
220 'description' => ts('When should the cache item expire'),
222 'where' => 'civicrm_cache.expired_date',
224 'table_name' => 'civicrm_cache',
226 'bao' => 'CRM_Core_BAO_Cache',
231 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
233 return Civi
::$statics[__CLASS__
]['fields'];
237 * Return a mapping from field-name to the corresponding key (as used in fields()).
240 * Array(string $name => string $uniqueName).
242 public static function &fieldKeys() {
243 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
244 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
246 return Civi
::$statics[__CLASS__
]['fieldKeys'];
250 * Returns the names of this table
254 public static function getTableName() {
255 return self
::$_tableName;
259 * Returns if this table needs to be logged
263 public function getLog() {
268 * Returns the list of fields that can be imported
270 * @param bool $prefix
274 public static function &import($prefix = FALSE) {
275 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cache', $prefix, []);
280 * Returns the list of fields that can be exported
282 * @param bool $prefix
286 public static function &export($prefix = FALSE) {
287 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cache', $prefix, []);
292 * Returns the list of indices
294 * @param bool $localize
298 public static function indices($localize = TRUE) {
300 'UI_group_path_date' => [
301 'name' => 'UI_group_path_date',
307 'localizable' => FALSE,
309 'sig' => 'civicrm_cache::1::group_name::path::created_date',
312 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;