Summary | Xcache not expiring on get() if prefix is set |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 1. Low |
Owners | slusarz (at) horde (dot) org |
Requester | wbreyha (at) gmx (dot) net |
Created | 10/04/2013 (4293 days ago) |
Due | |
Updated | 10/07/2013 (4290 days ago) |
Assigned | |
Resolved | 10/07/2013 (4290 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Assigned to Michael Slusarz
State ⇒ Resolved
Priority ⇒ 1. Low
commit 923c200e1165144f9d1bb4a1e39073bab4181dd8
Author: Michael M Slusarz <slusarz@horde.org>
Date: Sun Oct 6 22:53:29 2013 -0600
[mms] Fix key expiration for APC, Eaccelerator, and Xcache (
Bug #12735).framework/Cache/lib/Horde/Cache/Storage/Apc.php | 1 -
.../Cache/lib/Horde/Cache/Storage/Eaccelerator.php | 1 -
framework/Cache/lib/Horde/Cache/Storage/Xcache.php | 3 +--
framework/Cache/package.xml | 2 ++
4 files changed, 3 insertions(+), 4 deletions(-)
http://git.horde.org/horde-git/-/commit/923c200e1165144f9d1bb4a1e39073bab4181dd8
_setExpire is protected and used only in the Xcache Module for get()
and exists(). Both add the prefix before calling _setExpire.
Removing the second addition of the prefix in _setExpire() seems more
reasonable.
--------
--- Xcache.php.orig 2013-10-05 01:44:50.000000000 +0200
+++ Xcache.php 2013-10-05 01:55:58.000000000 +0200
@@ -97,7 +97,6 @@
// don't expire
return;
}
- $key = $this->_params['prefix'] . $key;
$expire = xcache_get($key . '_expire');
// set prune period
--------
Priority ⇒ 3. High
Patch ⇒ No
Milestone ⇒
Queue ⇒ Horde Framework Packages
Summary ⇒ Xcache not expiring on get() if prefix is set
Type ⇒ Bug
State ⇒ Unconfirmed
$fb = $cache->get($key, 360);
in case of Xcache get() adds the prefix to $key and calls
_setExpire(). But there the prefix is added again.
I think this will work as expected and similar to other caching modules
--------------
--- Xcache.php.orig 2013-10-05 01:44:50.000000000 +0200
+++ Xcache.php 2013-10-05 01:45:58.000000000 +0200
@@ -40,8 +40,10 @@
*/
public function get($key, $lifetime = 0)
{
- $key = $this->_params['prefix'] . $key;
+ /* prefix is added in _setExpire, too */
$this->_setExpire($key, $lifetime);
+ /* add it after calling _setExpire */
+ $key = $this->_params['prefix'] . $key;
$result = xcache_get($key);
return empty($result)
---------