* @access public
*/
static function &getItem($group, $path, $componentID = NULL) {
- static $_cache = NULL;
- if ($_cache === NULL) {
- $_cache = array();
- }
-
- $argString = "CRM_CT_{$group}_{$path}_{$componentID}";
- if (!array_key_exists($argString, $_cache)) {
- $cache = CRM_Utils_Cache::singleton();
- $_cache[$argString] = $cache->get($argString);
- if (!$_cache[$argString]) {
- $dao = new CRM_Core_DAO_Cache();
-
- $dao->group_name = $group;
- $dao->path = $path;
- $dao->component_id = $componentID;
-
- $data = NULL;
- if ($dao->find(TRUE)) {
- $data = unserialize($dao->data);
- }
- $dao->free();
- $_cache[$argString] = $data;
- $cache->set($argString, $_cache[$argString]);
- }
+ $dao = new CRM_Core_DAO_Cache();
+
+ $dao->group_name = $group;
+ $dao->path = $path;
+ $dao->component_id = $componentID;
+
+ $data = NULL;
+ if ($dao->find(TRUE)) {
+ $data = unserialize($dao->data);
}
- return $_cache[$argString];
+ $dao->free();
+ return $data;
}
/**
* @access public
*/
static function &getItems($group, $componentID = NULL) {
- static $_cache = NULL;
- if ($_cache === NULL) {
- $_cache = array();
- }
-
- $argString = "CRM_CT_CI_{$group}_{$componentID}";
- if (!array_key_exists($argString, $_cache)) {
- $cache = CRM_Utils_Cache::singleton();
- $_cache[$argString] = $cache->get($argString);
- if (!$_cache[$argString]) {
- $dao = new CRM_Core_DAO_Cache();
-
- $dao->group_name = $group;
- $dao->component_id = $componentID;
- $dao->find();
-
- $result = array(); // array($path => $data)
- while ($dao->fetch()) {
- $result[$dao->path] = unserialize($dao->data);
- }
- $dao->free();
-
- $_cache[$argString] = $result;
- $cache->set($argString, $_cache[$argString]);
- }
- }
+ $dao = new CRM_Core_DAO_Cache();
+
+ $dao->group_name = $group;
+ $dao->component_id = $componentID;
+ $dao->find();
- return $_cache[$argString];
+ $result = array(); // array($path => $data)
+ while ($dao->fetch()) {
+ $result[$dao->path] = unserialize($dao->data);
+ }
+ $dao->free();
+ return $result;
}
/**
* @access public
*/
static function setItem(&$data, $group, $path, $componentID = NULL) {
- static $_cache = NULL;
- if ($_cache === NULL) {
- $_cache = array();
- }
-
$dao = new CRM_Core_DAO_Cache();
$dao->group_name = $group;
$lock->release();
$dao->free();
-
- // set the cache in memory
- $argString = "CRM_CT_{$group}_{$path}_{$componentID}";
- $cache = CRM_Utils_Cache::singleton();
- $cache->set($argString, $dao->data);
}
/**