X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FUtils%2FCache%2FAPCcache.php;h=0a10a48b6dd5b1a7740095de7898e46838add7d4;hb=d5b9585b3da73a76dada27cfa2f791c6c4763cd5;hp=cfa49286b946bdf480187efec22c43ca9c437ead;hpb=64e59809d10c3ff342718a28f42983ec217dc282;p=civicrm-core.git diff --git a/CRM/Utils/Cache/APCcache.php b/CRM/Utils/Cache/APCcache.php index cfa49286b9..0a10a48b6d 100644 --- a/CRM/Utils/Cache/APCcache.php +++ b/CRM/Utils/Cache/APCcache.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 | +--------------------------------------------------------------------+ -*/ + */ /** * @@ -34,10 +34,10 @@ */ class CRM_Utils_Cache_APCcache { const DEFAULT_TIMEOUT = 3600; - const DEFAULT_PREFIX = ''; + const DEFAULT_PREFIX = ''; /** - * The default timeout to use + * The default timeout to use. * * @var int */ @@ -55,13 +55,14 @@ class CRM_Utils_Cache_APCcache { protected $_prefix = self::DEFAULT_PREFIX; /** - * Constructor + * Constructor. * - * @param array $config an array of configuration params + * @param array $config + * An array of configuration params. * * @return \CRM_Utils_Cache_APCcache */ - function __construct(&$config) { + public function __construct(&$config) { if (isset($config['timeout'])) { $this->_timeout = intval($config['timeout']); } @@ -76,7 +77,7 @@ class CRM_Utils_Cache_APCcache { * * @return bool */ - function set($key, &$value) { + public function set($key, &$value) { if (!apc_store($this->_prefix . $key, $value, $this->_timeout)) { return FALSE; } @@ -88,7 +89,7 @@ class CRM_Utils_Cache_APCcache { * * @return mixed */ - function &get($key) { + public function &get($key) { return apc_fetch($this->_prefix . $key); } @@ -97,11 +98,11 @@ class CRM_Utils_Cache_APCcache { * * @return bool|string[] */ - function delete($key) { + public function delete($key) { return apc_delete($this->_prefix . $key); } - function flush() { + public function flush() { $allinfo = apc_cache_info('user'); $keys = $allinfo['cache_list']; $prefix = $this->_prefix . "CRM_"; // Our keys follows this pattern: ([A-Za-z0-9_]+)?CRM_[A-Za-z0-9_]+ @@ -109,9 +110,11 @@ class CRM_Utils_Cache_APCcache { foreach ($keys as $key) { $name = $key['info']; - if ($prefix == substr($name,0,$lp)) { // Ours? + if ($prefix == substr($name, 0, $lp)) { + // Ours? apc_delete($this->_prefix . $name); } } } + }