本文整理汇总了PHP中CRM_Core_BAO_Setting::_cache方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_BAO_Setting::_cache方法的具体用法?PHP CRM_Core_BAO_Setting::_cache怎么用?PHP CRM_Core_BAO_Setting::_cache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_BAO_Setting
的用法示例。
在下文中一共展示了CRM_Core_BAO_Setting::_cache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: setMockSettingsMetaData
/**
* Temporarily alter the settings-metadata to add a mock setting.
*
* WARNING: The setting metadata will disappear on the next cache-clear.
*
* @param $extras
* @return void
*/
public function setMockSettingsMetaData($extras)
{
CRM_Core_BAO_Setting::$_cache = array();
$this->callAPISuccess('system', 'flush', array());
CRM_Core_BAO_Setting::$_cache = array();
CRM_Utils_Hook::singleton()->setHook('civicrm_alterSettingsMetaData', function (&$metadata, $domainId, $profile) use($extras) {
$metadata = array_merge($metadata, $extras);
});
$fields = $this->callAPISuccess('setting', 'getfields', array());
foreach ($extras as $key => $spec) {
$this->assertNotEmpty($spec['title']);
$this->assertEquals($spec['title'], $fields['values'][$key]['title']);
}
}