X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FCache%2FSqlGroup.php;h=5d3d5322586e030c4409361672d8a810e2d14fb2;hb=d5b9585b3da73a76dada27cfa2f791c6c4763cd5;hp=27194acb5c153a7fab0c3727e30aa69847bc1df7;hpb=a953e3e44d504c65ced19fac8c7ab8087d5f2072;p=civicrm-core.git diff --git a/CRM/Utils/Cache/SqlGroup.php b/CRM/Utils/Cache/SqlGroup.php index 27194acb5c..5d3d532258 100644 --- a/CRM/Utils/Cache/SqlGroup.php +++ b/CRM/Utils/Cache/SqlGroup.php @@ -1,7 +1,7 @@ group = $config['group']; - } else { + } + else { throw new RuntimeException("Cannot construct SqlGroup cache: missing group"); } if (isset($config['componentID'])) { $this->componentID = $config['componentID']; - } else { + } + else { $this->componentID = NULL; } $this->frontCache = array(); @@ -89,7 +92,7 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { * @param string $key * @param mixed $value */ - function set($key, &$value) { + public function set($key, &$value) { CRM_Core_BAO_Cache::setItem($value, $this->group, $key, $this->componentID); $this->frontCache[$key] = $value; } @@ -99,8 +102,8 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { * * @return mixed */ - function get($key) { - if (! array_key_exists($key, $this->frontCache)) { + public function get($key) { + if (!array_key_exists($key, $this->frontCache)) { $this->frontCache[$key] = CRM_Core_BAO_Cache::getItem($this->group, $key, $this->componentID); } return $this->frontCache[$key]; @@ -112,24 +115,25 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { * * @return mixed */ - function getFromFrontCache($key, $default = NULL) { + public function getFromFrontCache($key, $default = NULL) { return CRM_Utils_Array::value($key, $this->frontCache, $default); } /** * @param string $key */ - function delete($key) { + public function delete($key) { CRM_Core_BAO_Cache::deleteGroup($this->group, $key); unset($this->frontCache[$key]); } - function flush() { + public function flush() { CRM_Core_BAO_Cache::deleteGroup($this->group); $this->frontCache = array(); } - function prefetch() { + public function prefetch() { $this->frontCache = CRM_Core_BAO_Cache::getItems($this->group, $this->componentID); } + }