当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Utils_Cache::singleton方法代码示例

本文整理汇总了PHP中CRM_Utils_Cache::singleton方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_Cache::singleton方法的具体用法?PHP CRM_Utils_Cache::singleton怎么用?PHP CRM_Utils_Cache::singleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Utils_Cache的用法示例。


在下文中一共展示了CRM_Utils_Cache::singleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: tearDown

 public function tearDown()
 {
     global $civicrm_setting;
     $civicrm_setting = $this->origSetting;
     CRM_Utils_Cache::singleton()->flush();
     parent::tearDown();
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:7,代码来源:SettingTest.php

示例2: create

 /**
  * Create civicrm settings. This is the same as add but it clears the cache and
  * reloads the config object
  *
  * @param array $params
  *   Associated array of civicrm variables.
  *
  * @return void
  */
 public static function create($params)
 {
     self::add($params);
     $cache = CRM_Utils_Cache::singleton();
     $cache->delete('CRM_Core_Config');
     $cache->delete('CRM_Core_Config' . CRM_Core_Config::domainID());
     $config = CRM_Core_Config::singleton(TRUE, TRUE);
 }
开发者ID:riyadennis,项目名称:my_civicrm,代码行数:17,代码来源:ConfigSetting.php

示例3: setCache

 static function setCache($values, $group, $componentID = NULL, $contactID = NULL)
 {
     if (!isset(self::$_cache)) {
         self::$_cache = array();
     }
     $cacheKey = "CRM_Setting_{$group}_{$componentID}_{$contactID}";
     self::$_cache[$cacheKey] = $values;
     $globalCache = CRM_Utils_Cache::singleton();
     $result = $globalCache->set($cacheKey, $values);
     return $cacheKey;
 }
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:11,代码来源:Setting.php

示例4: getPetitionActivityType

 /**
  * Find the activity type ID for petitions.
  *
  * @return int
  *   The activity type ID.
  */
 public static function getPetitionActivityType()
 {
     $cache = CRM_Utils_Cache::singleton();
     $petitionActivityType = $cache->get('petitionemail_petitionActivityType');
     if (empty($petitionActivityType)) {
         try {
             $petitionTypeParams = array('name' => "activity_type", 'api.OptionValue.getsingle' => array('option_group_id' => '$value.id', 'name' => "Petition", 'options' => array('limit' => 1)), 'options' => array('limit' => 1));
             $petitionTypeInfo = civicrm_api3('OptionGroup', 'getsingle', $petitionTypeParams);
         } catch (CiviCRM_API3_Exception $e) {
             $error = $e->getMessage();
             CRM_Core_Error::debug_log_message(t('API Error: %1', array(1 => $error, 'domain' => 'com.aghstrategies.petitionemail')));
         }
         if (empty($petitionTypeInfo['api.OptionValue.getsingle']['value'])) {
             return;
         } else {
             $petitionActivityType = $petitionTypeInfo['api.OptionValue.getsingle']['value'];
             $cache->set('petitionemail_petitionActivityType', $petitionActivityType);
         }
     }
     return $petitionActivityType;
 }
开发者ID:aghstrategies,项目名称:com.aghstrategies.petitionemail,代码行数:27,代码来源:Utils.php

示例5: getTableColumnGroup

 /**
  * Get the database table name and column name for a custom field.
  *
  * @param int $fieldID
  *   The fieldID of the custom field.
  * @param bool $force
  *   Force the sql to be run again (primarily used for tests).
  *
  * @return array
  *   fatal is fieldID does not exists, else array of tableName, columnName
  */
 public static function getTableColumnGroup($fieldID, $force = FALSE)
 {
     $cacheKey = "CRM_Core_DAO_CustomField_CustomGroup_TableColumn_{$fieldID}";
     $cache = CRM_Utils_Cache::singleton();
     $fieldValues = $cache->get($cacheKey);
     if (empty($fieldValues) || $force) {
         $query = "\nSELECT cg.table_name, cf.column_name, cg.id\nFROM   civicrm_custom_group cg,\n       civicrm_custom_field cf\nWHERE  cf.custom_group_id = cg.id\nAND    cf.id = %1";
         $params = array(1 => array($fieldID, 'Integer'));
         $dao = CRM_Core_DAO::executeQuery($query, $params);
         if (!$dao->fetch()) {
             CRM_Core_Error::fatal();
         }
         $dao->free();
         $fieldValues = array($dao->table_name, $dao->column_name, $dao->id);
         $cache->set($cacheKey, $fieldValues);
     }
     return $fieldValues;
 }
开发者ID:Hack4Eugene,项目名称:Hack4Cause2016,代码行数:29,代码来源:CustomField.php

示例6: array

 /**
  * Get custom groups/fields for type of entity.
  *
  * An array containing all custom groups and their custom fields is returned.
  *
  * @param string $entityType - of the contact whose contact type is needed
  * @param int    $entityId   - optional - id of entity if we need to populate the tree with custom values.
  * @param int    $groupId    - optional group id (if we need it for a single group only)
  *                           - if groupId is 0 it gets for inline groups only
  *                           - if groupId is -1 we get for all groups
  *
  * @return array $groupTree  - array consisting of all groups and fields and optionally populated with custom data values.
  *
  * @access public
  *
  * @static
  *
  */
 public static function &getTree($entityType, &$form, $entityID = NULL, $groupID = NULL, $subType = NULL, $subName = NULL)
 {
     if ($entityID) {
         $entityID = CRM_Utils_Type::escape($entityID, 'Integer');
     }
     // create a new tree
     $strSelect = $strFrom = $strWhere = $orderBy = '';
     $tableData = array();
     // using tableData to build the queryString
     $tableData = array('civicrm_custom_field' => array('id', 'label', 'column_name', 'data_type', 'html_type', 'default_value', 'attributes', 'is_required', 'is_view', 'help_pre', 'help_post', 'options_per_line', 'start_date_years', 'end_date_years', 'date_format', 'time_format', 'option_group_id'), 'civicrm_custom_group' => array('id', 'name', 'table_name', 'title', 'help_pre', 'help_post', 'collapse_display', 'is_multiple', 'extends', 'extends_entity_column_id', 'extends_entity_column_value', 'max_multiple'));
     // create select
     $select = array();
     foreach ($tableData as $tableName => $tableColumn) {
         foreach ($tableColumn as $columnName) {
             $alias = $tableName . "_" . $columnName;
             $select[] = "{$tableName}.{$columnName} as {$tableName}_{$columnName}";
         }
     }
     $strSelect = "SELECT " . implode(', ', $select);
     // from, where, order by
     $strFrom = "\nFROM     civicrm_custom_group\nLEFT JOIN civicrm_custom_field ON (civicrm_custom_field.custom_group_id = civicrm_custom_group.id)\n";
     // if entity is either individual, organization or household pls get custom groups for 'contact' too.
     if ($entityType == "Individual" || $entityType == 'Organization' || $entityType == 'Household') {
         $in = "'{$entityType}', 'Contact'";
     } elseif (strpos($entityType, "'") !== FALSE) {
         // this allows the calling function to send in multiple entity types
         $in = $entityType;
     } else {
         // quote it
         $in = "'{$entityType}'";
     }
     if ($subType) {
         $subTypeClause = '';
         if (is_array($subType)) {
             $subType = implode(',', $subType);
         }
         if (strpos($subType, ',')) {
             $subTypeParts = explode(',', $subType);
             $subTypeClauses = array();
             foreach ($subTypeParts as $subTypePart) {
                 $subTypePart = CRM_Core_DAO::VALUE_SEPARATOR . trim($subTypePart, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
                 $subTypeClauses[] = "civicrm_custom_group.extends_entity_column_value LIKE '%{$subTypePart}%'";
             }
             $subTypeClause = '(' . implode(' OR ', $subTypeClauses) . " OR civicrm_custom_group.extends_entity_column_value IS NULL )";
         } else {
             $subType = CRM_Core_DAO::VALUE_SEPARATOR . trim($subType, CRM_Core_DAO::VALUE_SEPARATOR) . CRM_Core_DAO::VALUE_SEPARATOR;
             $subTypeClause = "( civicrm_custom_group.extends_entity_column_value LIKE '%{$subType}%'\n   OR   civicrm_custom_group.extends_entity_column_value IS NULL )";
         }
         $strWhere = "\nWHERE civicrm_custom_group.is_active = 1\n  AND civicrm_custom_field.is_active = 1\n  AND civicrm_custom_group.extends IN ({$in})\n  AND {$subTypeClause}\n";
         if ($subName) {
             $strWhere .= " AND civicrm_custom_group.extends_entity_column_id = {$subName} ";
         }
     } else {
         $strWhere = "\nWHERE civicrm_custom_group.is_active = 1\n  AND civicrm_custom_field.is_active = 1\n  AND civicrm_custom_group.extends IN ({$in})\n  AND civicrm_custom_group.extends_entity_column_value IS NULL\n";
     }
     $params = array();
     if ($groupID > 0) {
         // since we want a specific group id we add it to the where clause
         $strWhere .= " AND civicrm_custom_group.id = %1";
         $params[1] = array($groupID, 'Integer');
     } elseif (!$groupID) {
         // since groupID is false we need to show all Inline groups
         $strWhere .= " AND civicrm_custom_group.style = 'Inline'";
     }
     // ensure that the user has access to these custom groups
     $strWhere .= " AND " . CRM_Core_Permission::customGroupClause(CRM_Core_Permission::VIEW, 'civicrm_custom_group.');
     $orderBy = "\nORDER BY civicrm_custom_group.weight,\n         civicrm_custom_group.title,\n         civicrm_custom_field.weight,\n         civicrm_custom_field.label\n";
     // final query string
     $queryString = "{$strSelect} {$strFrom} {$strWhere} {$orderBy}";
     // lets see if we can retrieve the groupTree from cache
     $cacheString = $queryString;
     if ($groupID > 0) {
         $cacheString .= "_{$groupID}";
     } else {
         $cacheString .= "_Inline";
     }
     $cacheKey = "CRM_Core_DAO_CustomGroup_Query " . md5($cacheString);
     $cache = CRM_Utils_Cache::singleton();
     $groupTree = $cache->get($cacheKey);
     if (empty($groupTree)) {
         $groupTree = array();
         $crmDAO = CRM_Core_DAO::executeQuery($queryString, $params);
//.........这里部分代码省略.........
开发者ID:peteainsworth,项目名称:civicrm-4.2.9-drupal,代码行数:101,代码来源:CustomGroup.php

示例7: group

 /**
  * @param $type
  * @param null $contactID
  * @param string $tableName
  * @param null $allGroups
  * @param null $includedGroups
  *
  * @return array
  */
 public static function group($type, $contactID = NULL, $tableName = 'civicrm_saved_search', $allGroups = NULL, $includedGroups = NULL)
 {
     $acls = CRM_ACL_BAO_Cache::build($contactID);
     $ids = array();
     if (!empty($acls)) {
         $aclKeys = array_keys($acls);
         $aclKeys = implode(',', $aclKeys);
         $cacheKey = "{$tableName}-{$aclKeys}";
         $cache = CRM_Utils_Cache::singleton();
         $ids = $cache->get($cacheKey);
         if (!$ids) {
             $query = "\nSELECT   a.operation, a.object_id\n  FROM   civicrm_acl_cache c, civicrm_acl a\n WHERE   c.acl_id       =  a.id\n   AND   a.is_active    =  1\n   AND   a.object_table = %1\n   AND   a.id        IN ( {$aclKeys} )\nGROUP BY a.operation,a.object_id\nORDER BY a.object_id\n";
             $params = array(1 => array($tableName, 'String'));
             $dao = CRM_Core_DAO::executeQuery($query, $params);
             while ($dao->fetch()) {
                 if ($dao->object_id) {
                     if (self::matchType($type, $dao->operation)) {
                         $ids[] = $dao->object_id;
                     }
                 } else {
                     // this user has got the permission for all objects of this type
                     // check if the type matches
                     if (self::matchType($type, $dao->operation)) {
                         foreach ($allGroups as $id => $dontCare) {
                             $ids[] = $id;
                         }
                     }
                     break;
                 }
             }
             $cache->set($cacheKey, $ids);
         }
     }
     if (empty($ids) && !empty($includedGroups) && is_array($includedGroups)) {
         $ids = $includedGroups;
     }
     CRM_Utils_Hook::aclGroup($type, $contactID, $tableName, $allGroups, $ids);
     return $ids;
 }
开发者ID:prashantgajare,项目名称:civicrm-core,代码行数:48,代码来源:ACL.php

示例8: commonProcess

 public function commonProcess(&$params)
 {
     require_once "CRM/Core/BAO/Setting.php";
     CRM_Core_BAO_Setting::add($params);
     // also delete the CRM_Core_Config key from the database
     $cache =& CRM_Utils_Cache::singleton();
     $cache->delete('CRM_Core_Config');
     // save autocomplete search options
     if (CRM_Utils_Array::value('autocompleteContactSearch', $params)) {
         $config =& new CRM_Core_DAO_Preferences();
         $config->domain_id = CRM_Core_Config::domainID();
         $config->find(true);
         $config->contact_autocomplete_options = CRM_Core_DAO::VALUE_SEPARATOR . implode(CRM_Core_DAO::VALUE_SEPARATOR, array_keys($params['autocompleteContactSearch'])) . CRM_Core_DAO::VALUE_SEPARATOR;
         $config->save();
     }
     // update time for date formats when global time is changed
     if (CRM_Utils_Array::value('timeInputFormat', $params)) {
         $query = "UPDATE civicrm_preferences_date SET time_format = " . $params['timeInputFormat'] . " \n                      WHERE time_format IS NOT NULL AND time_format <> ''";
         CRM_Core_DAO::executeQuery($query);
     }
     CRM_Core_Session::setStatus(ts('Your changes have been saved.'));
 }
开发者ID:bhirsch,项目名称:voipdev,代码行数:22,代码来源:Setting.php

示例9: getOptionValuesArray

 /**
  * Get the values of all option values given an option group ID. Store in system cache
  * Does not take any filtering arguments. The object is to avoid hitting the DB and retrieve
  * from memory
  *
  * @param int $optionGroupID
  *   The option group for which we want the values from.
  *
  * @return array
  *   an array of array of values for this option group
  */
 public static function getOptionValuesArray($optionGroupID)
 {
     // check if we can get the field values from the system cache
     $cacheKey = "CRM_Core_BAO_OptionValue_OptionGroupID_{$optionGroupID}";
     $cache = CRM_Utils_Cache::singleton();
     $optionValues = $cache->get($cacheKey);
     if (empty($optionValues)) {
         $dao = new CRM_Core_DAO_OptionValue();
         $dao->option_group_id = $optionGroupID;
         $dao->orderBy('weight ASC, label ASC');
         $dao->find();
         $optionValues = array();
         while ($dao->fetch()) {
             $optionValues[$dao->id] = array();
             CRM_Core_DAO::storeValues($dao, $optionValues[$dao->id]);
         }
         $cache->set($cacheKey, $optionValues);
     }
     return $optionValues;
 }
开发者ID:kidaa30,项目名称:yes,代码行数:31,代码来源:OptionValue.php

示例10: populate

 /**
  * DEPRECATED generic populate method
  * All pseudoconstant functions that use this method are also deprecated.
  *
  * The static array $var is populated from the db
  * using the <b>$name DAO</b>.
  *
  * Note: any database errors will be trapped by the DAO.
  *
  * @param array   $var        the associative array we will fill
  * @param string  $name       the name of the DAO
  * @param boolean $all        get all objects. default is to get only active ones.
  * @param string  $retrieve   the field that we are interested in (normally name, differs in some objects)
  * @param string  $filter     the field that we want to filter the result set with
  * @param string  $condition  the condition that gets passed to the final query as the WHERE clause
  *
  * @return void
  * @access public
  * @static
  */
 public static function populate(&$var, $name, $all = FALSE, $retrieve = 'name', $filter = 'is_active', $condition = NULL, $orderby = NULL, $key = 'id', $force = NULL)
 {
     $cacheKey = "CRM_PC_{$name}_{$all}_{$key}_{$retrieve}_{$filter}_{$condition}_{$orderby}";
     $cache = CRM_Utils_Cache::singleton();
     $var = $cache->get($cacheKey);
     if ($var && empty($force)) {
         return $var;
     }
     $object = new $name();
     $object->selectAdd();
     $object->selectAdd("{$key}, {$retrieve}");
     if ($condition) {
         $object->whereAdd($condition);
     }
     if (!$orderby) {
         $object->orderBy($retrieve);
     } else {
         $object->orderBy($orderby);
     }
     if (!$all) {
         $object->{$filter} = 1;
     }
     $object->find();
     $var = array();
     while ($object->fetch()) {
         $var[$object->{$key}] = $object->{$retrieve};
     }
     $cache->set($cacheKey, $var);
 }
开发者ID:TheCraftyCanvas,项目名称:aegir-platforms,代码行数:49,代码来源:PseudoConstant.php

示例11:

 /**
  * Singleton function used to manage this object.
  *
  * @param $loadFromDB boolean  whether to load from the database
  * @param $force      boolean  whether to force a reconstruction
  *
  * @return object
  * @static
  */
 static function &singleton($loadFromDB = true, $force = false)
 {
     if (self::$_singleton === null || $force) {
         // first, attempt to get configuration object from cache
         require_once 'CRM/Utils/Cache.php';
         $cache =& CRM_Utils_Cache::singleton();
         self::$_singleton = $cache->get('CRM_Core_Config');
         // if not in cache, fire off config construction
         if (!self::$_singleton) {
             self::$_singleton = new CRM_Core_Config();
             self::$_singleton->_initialize();
             //initialize variables. for gencode we cannot load from the
             //db since the db might not be initialized
             if ($loadFromDB) {
                 self::$_singleton->_initVariables();
                 // retrieve and overwrite stuff from the settings file
                 self::$_singleton->setCoreVariables();
             }
             $cache->set('CRM_Core_Config', self::$_singleton);
         } else {
             // we retrieve the object from memcache, so we now initialize the objects
             self::$_singleton->_initialize();
         }
         self::$_singleton->initialized = 1;
         if (isset(self::$_singleton->customPHPPathDir) && self::$_singleton->customPHPPathDir) {
             $include_path = self::$_singleton->customPHPPathDir . PATH_SEPARATOR . get_include_path();
             set_include_path($include_path);
         }
         // set the callback at the very very end, to avoid an infinite loop
         // set the error callback
         CRM_Core_Error::setCallback();
     }
     return self::$_singleton;
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:43,代码来源:Config.php

示例12: populate

 /**
  * populate the object from the database. generic populate
  * method
  *
  * The static array $var is populated from the db
  * using the <b>$name DAO</b>. 
  *
  * Note: any database errors will be trapped by the DAO.
  *
  * @param array   $var        the associative array we will fill
  * @param string  $name       the name of the DAO
  * @param boolean $all        get all objects. default is to get only active ones.
  * @param string  $retrieve   the field that we are interested in (normally name, differs in some objects)
  * @param string  $filter     the field that we want to filter the result set with
  * @param string  $condition  the condition that gets passed to the final query as the WHERE clause
  *
  * @return void
  * @access public
  * @static
  */
 public static function populate(&$var, $name, $all = false, $retrieve = 'name', $filter = 'is_active', $condition = null, $orderby = null, $key = 'id')
 {
     $cacheKey = "CRM_PC_{$name}_{$all}_{$key}_{$retrieve}_{$filter}_{$condition}_{$orderby}";
     $cache =& CRM_Utils_Cache::singleton();
     $var = $cache->get($cacheKey);
     if ($var) {
         return $var;
     }
     require_once str_replace('_', DIRECTORY_SEPARATOR, $name) . ".php";
     eval('$object = new ' . $name . '( );');
     $object->selectAdd();
     $object->selectAdd("{$key}, {$retrieve}");
     if ($condition) {
         $object->whereAdd($condition);
     }
     if (!$orderby) {
         $object->orderBy($retrieve);
     } else {
         $object->orderBy($orderby);
     }
     if (!$all) {
         $object->{$filter} = 1;
     }
     $object->find();
     $var = array();
     while ($object->fetch()) {
         $var[$object->{$key}] = $object->{$retrieve};
     }
     $cache->set($cacheKey, $var);
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:50,代码来源:PseudoConstant.php

示例13: getSelectElements

 /**
  * Get a list of elements for select box.
  * Note that this used to default to using the hex(01) character - which results in an invalid character being used in form fields
  * which was not handled well be anything that loaded & resaved the html (outside core)
  * The use of this separator is now explicit in the calling functions as a step towards it's removal
  *
  * @param bool $all
  * @param bool $isSeparator
  * @param string $separator
  *
  * @return mixed
  */
 public static function getSelectElements($all = FALSE, $isSeparator = TRUE, $separator = '__')
 {
     static $_cache = NULL;
     if ($_cache === NULL) {
         $_cache = array();
     }
     $argString = $all ? 'CRM_CT_GSE_1' : 'CRM_CT_GSE_0';
     $argString .= $isSeparator ? '_1' : '_0';
     $argString .= $separator;
     if (!array_key_exists($argString, $_cache)) {
         $cache = CRM_Utils_Cache::singleton();
         $_cache[$argString] = $cache->get($argString);
         if (!$_cache[$argString]) {
             $_cache[$argString] = array();
             $sql = "\nSELECT    c.name as child_name , c.label as child_label , c.id as child_id,\n          p.name as parent_name, p.label as parent_label, p.id as parent_id\nFROM      civicrm_contact_type c\nLEFT JOIN civicrm_contact_type p ON ( c.parent_id = p.id )\nWHERE     ( c.name IS NOT NULL )\n";
             if ($all === FALSE) {
                 $sql .= "\nAND   c.is_active = 1\nAND   ( p.is_active = 1 OR p.id IS NULL )\n";
             }
             $sql .= " ORDER BY c.id";
             $values = array();
             $dao = CRM_Core_DAO::executeQuery($sql);
             while ($dao->fetch()) {
                 if (!empty($dao->parent_id)) {
                     $key = $isSeparator ? $dao->parent_name . $separator . $dao->child_name : $dao->child_name;
                     $label = "- {$dao->child_label}";
                     $pName = $dao->parent_name;
                 } else {
                     $key = $dao->child_name;
                     $label = $dao->child_label;
                     $pName = $dao->child_name;
                 }
                 if (!isset($values[$pName])) {
                     $values[$pName] = array();
                 }
                 $values[$pName][] = array('key' => $key, 'label' => $label);
             }
             $selectElements = array();
             foreach ($values as $pName => $elements) {
                 foreach ($elements as $element) {
                     $selectElements[$element['key']] = $element['label'];
                 }
             }
             $_cache[$argString] = $selectElements;
             $cache->set($argString, $_cache[$argString]);
         }
     }
     return $_cache[$argString];
 }
开发者ID:BorislavZlatanov,项目名称:civicrm-core,代码行数:60,代码来源:ContactType.php

示例14: flushCache

 /**
  * Reset the memory cache, typically memcached
  */
 static function flushCache($daoName = null)
 {
     // flush out all cache entries so we can reload new data
     // a bit aggressive, but livable for now
     require_once 'CRM/Utils/Cache.php';
     $cache =& CRM_Utils_Cache::singleton();
     $cache->flush();
 }
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:11,代码来源:System.php

示例15: setItem

 /**
  * Store an item in the DB cache.
  *
  * @param object $data
  *   (required) A reference to the data that will be serialized and stored.
  * @param string $group
  *   (required) The group name of the item.
  * @param string $path
  *   (required) The path under which this item is stored.
  * @param int $componentID
  *   The optional component ID (so componenets can share the same name space).
  */
 public static function setItem(&$data, $group, $path, $componentID = NULL)
 {
     if (self::$_cache === NULL) {
         self::$_cache = array();
     }
     $dao = new CRM_Core_DAO_Cache();
     $dao->group_name = $group;
     $dao->path = $path;
     $dao->component_id = $componentID;
     // get a lock so that multiple ajax requests on the same page
     // dont trample on each other
     // CRM-11234
     $lock = Civi::lockManager()->acquire("cache.{$group}_{$path}._{$componentID}");
     if (!$lock->isAcquired()) {
         CRM_Core_Error::fatal();
     }
     $dao->find(TRUE);
     $dao->data = serialize($data);
     $dao->created_date = date('YmdHis');
     $dao->save(FALSE);
     $lock->release();
     $dao->free();
     // cache coherency - refresh or remove dependent caches
     $argString = "CRM_CT_{$group}_{$path}_{$componentID}";
     $cache = CRM_Utils_Cache::singleton();
     $data = unserialize($dao->data);
     self::$_cache[$argString] = $data;
     $cache->set($argString, $data);
     $argString = "CRM_CT_CI_{$group}_{$componentID}";
     unset(self::$_cache[$argString]);
     $cache->delete($argString);
 }
开发者ID:hyebahi,项目名称:civicrm-core,代码行数:44,代码来源:Cache.php


注:本文中的CRM_Utils_Cache::singleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。