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:2b7084711ac3f619ce6f0cc8361dffa4)
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;
36 * @var int|string|null
37 * (SQL type: int unsigned)
38 * Note that values will be retrieved from the database as a string.
43 * group name for cache element, useful in cleaning cache elements
46 * (SQL type: varchar(32))
47 * Note that values will be retrieved from the database as a string.
52 * Unique path name for cache element
55 * (SQL type: varchar(255))
56 * Note that values will be retrieved from the database as a string.
61 * data associated with this path
64 * (SQL type: longtext)
65 * Note that values will be retrieved from the database as a string.
70 * Component that this menu item belongs to
72 * @var int|string|null
73 * (SQL type: int unsigned)
74 * Note that values will be retrieved from the database as a string.
79 * When was the cache item created
82 * (SQL type: timestamp)
83 * Note that values will be retrieved from the database as a string.
88 * When should the cache item expire
91 * (SQL type: timestamp)
92 * Note that values will be retrieved from the database as a string.
99 public function __construct() {
100 $this->__table
= 'civicrm_cache';
101 parent
::__construct();
105 * Returns localized title of this entity.
107 * @param bool $plural
108 * Whether to return the plural version of the title.
110 public static function getEntityTitle($plural = FALSE) {
111 return $plural ?
ts('Caches') : ts('Cache');
115 * Returns foreign keys and entity references.
118 * [CRM_Core_Reference_Interface]
120 public static function getReferenceColumns() {
121 if (!isset(Civi
::$statics[__CLASS__
]['links'])) {
122 Civi
::$statics[__CLASS__
]['links'] = static::createReferenceColumns(__CLASS__
);
123 Civi
::$statics[__CLASS__
]['links'][] = new CRM_Core_Reference_Basic(self
::getTableName(), 'component_id', 'civicrm_component', 'id');
124 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'links_callback', Civi
::$statics[__CLASS__
]['links']);
126 return Civi
::$statics[__CLASS__
]['links'];
130 * Returns all the column names of this table
134 public static function &fields() {
135 if (!isset(Civi
::$statics[__CLASS__
]['fields'])) {
136 Civi
::$statics[__CLASS__
]['fields'] = [
139 'type' => CRM_Utils_Type
::T_INT
,
140 'title' => ts('Cache ID'),
141 'description' => ts('Unique table ID'),
143 'where' => 'civicrm_cache.id',
144 'table_name' => 'civicrm_cache',
146 'bao' => 'CRM_Core_BAO_Cache',
155 'name' => 'group_name',
156 'type' => CRM_Utils_Type
::T_STRING
,
157 'title' => ts('Group Name'),
158 'description' => ts('group name for cache element, useful in cleaning cache elements'),
161 'size' => CRM_Utils_Type
::MEDIUM
,
162 'where' => 'civicrm_cache.group_name',
163 'table_name' => 'civicrm_cache',
165 'bao' => 'CRM_Core_BAO_Cache',
171 'type' => CRM_Utils_Type
::T_STRING
,
172 'title' => ts('Path'),
173 'description' => ts('Unique path name for cache element'),
175 'size' => CRM_Utils_Type
::HUGE
,
176 'where' => 'civicrm_cache.path',
177 'table_name' => 'civicrm_cache',
179 'bao' => 'CRM_Core_BAO_Cache',
185 'type' => CRM_Utils_Type
::T_LONGTEXT
,
186 'title' => ts('Data'),
187 'description' => ts('data associated with this path'),
188 'where' => 'civicrm_cache.data',
189 'table_name' => 'civicrm_cache',
191 'bao' => 'CRM_Core_BAO_Cache',
196 'name' => 'component_id',
197 'type' => CRM_Utils_Type
::T_INT
,
198 'title' => ts('Component ID'),
199 'description' => ts('Component that this menu item belongs to'),
200 'where' => 'civicrm_cache.component_id',
201 'table_name' => 'civicrm_cache',
203 'bao' => 'CRM_Core_BAO_Cache',
205 'FKClassName' => 'CRM_Core_DAO_Component',
208 'label' => ts("Component"),
210 'pseudoconstant' => [
211 'table' => 'civicrm_component',
213 'labelColumn' => 'name',
218 'name' => 'created_date',
219 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
220 'title' => ts('Created Date'),
221 'description' => ts('When was the cache item created'),
222 'where' => 'civicrm_cache.created_date',
223 'default' => 'CURRENT_TIMESTAMP',
224 'table_name' => 'civicrm_cache',
226 'bao' => 'CRM_Core_BAO_Cache',
231 'name' => 'expired_date',
232 'type' => CRM_Utils_Type
::T_TIMESTAMP
,
233 'title' => ts('Expired Date'),
234 'description' => ts('When should the cache item expire'),
236 'where' => 'civicrm_cache.expired_date',
238 'table_name' => 'civicrm_cache',
240 'bao' => 'CRM_Core_BAO_Cache',
245 CRM_Core_DAO_AllCoreTables
::invoke(__CLASS__
, 'fields_callback', Civi
::$statics[__CLASS__
]['fields']);
247 return Civi
::$statics[__CLASS__
]['fields'];
251 * Return a mapping from field-name to the corresponding key (as used in fields()).
254 * Array(string $name => string $uniqueName).
256 public static function &fieldKeys() {
257 if (!isset(Civi
::$statics[__CLASS__
]['fieldKeys'])) {
258 Civi
::$statics[__CLASS__
]['fieldKeys'] = array_flip(CRM_Utils_Array
::collect('name', self
::fields()));
260 return Civi
::$statics[__CLASS__
]['fieldKeys'];
264 * Returns the names of this table
268 public static function getTableName() {
269 return self
::$_tableName;
273 * Returns if this table needs to be logged
277 public function getLog() {
282 * Returns the list of fields that can be imported
284 * @param bool $prefix
288 public static function &import($prefix = FALSE) {
289 $r = CRM_Core_DAO_AllCoreTables
::getImports(__CLASS__
, 'cache', $prefix, []);
294 * Returns the list of fields that can be exported
296 * @param bool $prefix
300 public static function &export($prefix = FALSE) {
301 $r = CRM_Core_DAO_AllCoreTables
::getExports(__CLASS__
, 'cache', $prefix, []);
306 * Returns the list of indices
308 * @param bool $localize
312 public static function indices($localize = TRUE) {
314 'UI_group_path_date' => [
315 'name' => 'UI_group_path_date',
321 'localizable' => FALSE,
323 'sig' => 'civicrm_cache::1::group_name::path::created_date',
326 return ($localize && !empty($indices)) ? CRM_Core_DAO_AllCoreTables
::multilingualize(__CLASS__
, $indices) : $indices;