projects
/
civicrm-core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote branch 'canonical/master' into merge-forward
[civicrm-core.git]
/
CRM
/
Utils
/
Cache
/
Memcached.php
diff --git
a/CRM/Utils/Cache/Memcached.php
b/CRM/Utils/Cache/Memcached.php
index 9962f7bf8fb4123cb0ce9390b2bd7608dd48f08e..b07eef40aa3a16f3462c6531229ae9f9a3847a32 100644
(file)
--- a/
CRM/Utils/Cache/Memcached.php
+++ b/
CRM/Utils/Cache/Memcached.php
@@
-81,8
+81,9
@@
class CRM_Utils_Cache_Memcached {
/**
* Constructor
*
/**
* Constructor
*
- * @param array $config an array of configuration params
- * @return void
+ * @param array $config an array of configuration params
+ *
+ * @return \CRM_Utils_Cache_Memcached
*/
function __construct($config) {
if (isset($config['host'])) {
*/
function __construct($config) {
if (isset($config['host'])) {
@@
-107,6
+108,13
@@
class CRM_Utils_Cache_Memcached {
}
}
}
}
+ /**
+ * @param $key
+ * @param $value
+ *
+ * @return bool
+ * @throws Exception
+ */
function set($key, &$value) {
$key = $this->cleanKey($key);
if (!$this->_cache->set($key, $value, $this->_timeout)) {
function set($key, &$value) {
$key = $this->cleanKey($key);
if (!$this->_cache->set($key, $value, $this->_timeout)) {
@@
-117,17
+125,32
@@
class CRM_Utils_Cache_Memcached {
return TRUE;
}
return TRUE;
}
+ /**
+ * @param $key
+ *
+ * @return mixed
+ */
function &get($key) {
$key = $this->cleanKey($key);
$result = $this->_cache->get($key);
return $result;
}
function &get($key) {
$key = $this->cleanKey($key);
$result = $this->_cache->get($key);
return $result;
}
+ /**
+ * @param $key
+ *
+ * @return mixed
+ */
function delete($key) {
$key = $this->cleanKey($key);
return $this->_cache->delete($key);
}
function delete($key) {
$key = $this->cleanKey($key);
return $this->_cache->delete($key);
}
+ /**
+ * @param $key
+ *
+ * @return mixed|string
+ */
function cleanKey($key) {
$key = preg_replace('/\s+|\W+/', '_', $this->_prefix . $key);
if ( strlen($key) > self::MAX_KEY_LEN ) {
function cleanKey($key) {
$key = preg_replace('/\s+|\W+/', '_', $this->_prefix . $key);
if ( strlen($key) > self::MAX_KEY_LEN ) {
@@
-138,6
+161,9
@@
class CRM_Utils_Cache_Memcached {
return $key;
}
return $key;
}
+ /**
+ * @return mixed
+ */
function flush() {
return $this->_cache->flush();
}
function flush() {
return $this->_cache->flush();
}