diff options
-rw-r--r-- | engine/classes/ElggMemcache.php | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/engine/classes/ElggMemcache.php b/engine/classes/ElggMemcache.php index 7d19fb2c7..1fd3be0d1 100644 --- a/engine/classes/ElggMemcache.php +++ b/engine/classes/ElggMemcache.php @@ -147,15 +147,20 @@ class ElggMemcache extends ElggSharedMemoryCache { /** * Saves a name and value to the cache * - * @param string $key Name - * @param string $data Value + * @param string $key Name + * @param string $data Value + * @param integer $expires Expires (in seconds) * * @return bool */ - public function save($key, $data) { + public function save($key, $data, $expires = null) { $key = $this->_makeMemcacheKey($key); - $result = $this->memcache->set($key, $data, null, $this->expires); + if ($expires === null) { + $expires = $this->expires; + } + + $result = $this->memcache->set($key, $data, null, $expires); if (!$result) { elgg_log("MEMCACHE: FAILED TO SAVE $key", 'ERROR'); } |