<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
*
* @return \CRM_Utils_Cache_Memcached
*/
- function __construct($config) {
+ public function __construct($config) {
if (isset($config['host'])) {
$this->_host = $config['host'];
}
}
}
- function set($key, &$value) {
+ /**
+ * @param $key
+ * @param $value
+ *
+ * @return bool
+ * @throws Exception
+ */
+ public function set($key, &$value) {
$key = $this->cleanKey($key);
if (!$this->_cache->set($key, $value, $this->_timeout)) {
CRM_Core_Error::debug( 'Result Code: ', $this->_cache->getResultMessage());
return TRUE;
}
- function &get($key) {
+ /**
+ * @param $key
+ *
+ * @return mixed
+ */
+ public function &get($key) {
$key = $this->cleanKey($key);
$result = $this->_cache->get($key);
return $result;
}
- function delete($key) {
+ /**
+ * @param $key
+ *
+ * @return mixed
+ */
+ public function delete($key) {
$key = $this->cleanKey($key);
return $this->_cache->delete($key);
}
- function cleanKey($key) {
+ /**
+ * @param $key
+ *
+ * @return mixed|string
+ */
+ public function cleanKey($key) {
$key = preg_replace('/\s+|\W+/', '_', $this->_prefix . $key);
if ( strlen($key) > self::MAX_KEY_LEN ) {
$md5Key = md5($key); // this should be 32 characters in length
return $key;
}
- function flush() {
+ /**
+ * @return mixed
+ */
+ public function flush() {
return $this->_cache->flush();
}
}