X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FCache%2FSqlGroup.php;h=5d3d5322586e030c4409361672d8a810e2d14fb2;hb=d5b9585b3da73a76dada27cfa2f791c6c4763cd5;hp=7234010a5af1457b23ee2cca134dfb9830b4714d;hpb=00be918220e9ac8f6d25d12ed3c9c49fddd07ff7;p=civicrm-core.git diff --git a/CRM/Utils/Cache/SqlGroup.php b/CRM/Utils/Cache/SqlGroup.php index 7234010a5a..5d3d532258 100644 --- a/CRM/Utils/Cache/SqlGroup.php +++ b/CRM/Utils/Cache/SqlGroup.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -41,7 +41,7 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { /** - * The host name of the memcached server + * The host name of the memcached server. * * @var string */ @@ -58,9 +58,10 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { protected $frontCache; /** - * Constructor + * Constructor. * - * @param array $config an array of configuration params + * @param array $config + * An array of configuration params. * - group: string * - componentID: int * - prefetch: bool, whether to preemptively read the entire cache group; default: TRUE @@ -71,12 +72,14 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { public function __construct($config) { if (isset($config['group'])) { $this->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(); @@ -100,7 +103,7 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { * @return mixed */ public function get($key) { - if (! array_key_exists($key, $this->frontCache)) { + if (!array_key_exists($key, $this->frontCache)) { $this->frontCache[$key] = CRM_Core_BAO_Cache::getItem($this->group, $key, $this->componentID); } return $this->frontCache[$key]; @@ -132,4 +135,5 @@ class CRM_Utils_Cache_SqlGroup implements CRM_Utils_Cache_Interface { public function prefetch() { $this->frontCache = CRM_Core_BAO_Cache::getItems($this->group, $this->componentID); } + }