diff options
-rw-r--r-- | framework/Data/TAPCCache.php | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/framework/Data/TAPCCache.php b/framework/Data/TAPCCache.php index c6b8deb4..cef684fb 100644 --- a/framework/Data/TAPCCache.php +++ b/framework/Data/TAPCCache.php @@ -102,10 +102,7 @@ class TAPCCache extends TModule implements ICache */
public function get($key)
{
- $ret=apc_fetch($this->_prefix.$key);
- if((boolean)apc_fetch($this->_prefix.$key.self::SERIALIZED))
- $ret=unserialize($ret);
- return $ret;
+ return apc_fetch($this->_prefix.$key);
}
/**
@@ -121,10 +118,8 @@ class TAPCCache extends TModule implements ICache */
public function set($key,$value,$expiry=0)
{
- if(!is_string($value)) {
- $value=serialize($value);
- apc_store($this->_prefix.$key.self::SERIALIZED,1,$expiry);
- }
+ if(is_array($value))
+ $value=new ArrayObject($value);
return apc_store($this->_prefix.$key,$value,$expiry);
}
@@ -167,7 +162,6 @@ class TAPCCache extends TModule implements ICache */
public function delete($key)
{
- apc_delete($this->_prefix.$key.self::SERIALIZED);
return apc_delete($this->_prefix.$key);
}
@@ -178,40 +172,6 @@ class TAPCCache extends TModule implements ICache {
return apc_clear_cache('user');
}
-
-
-
- /**
- * Retrieves a value from cache with a specified key.
- * Does not check wether to unserialized
- * @return mixed the value stored in cache, false if the value is not in the cache or expired.
- */
- public function getRaw($key)
- {
- return apc_fetch($this->_prefix.$key);
- }
-
- /**
- * Stores a value identified by a key into cache.
- * If the cache already contains such a key, the existing value and
- * expiration time will be replaced with the new ones.
- *
- * will only serialized pure object, not array, if your array contains object, you need to call {@link set}
- *
- * @param string the key identifying the value to be cached
- * @param mixed the value to be cached
- * @param integer the expiration time of the value,
- * 0 means never expire,
- * @return boolean true if the value is successfully stored into cache, false otherwise
- */
- public function setRaw($key,$value,$expiry=0)
- {
- if(is_object($value)) {
- $value=serialize($value);
- apc_store($this->_prefix.$key.self::SERIALIZED,1,$expiry);
- }
- return apc_store($this->_prefix.$key,$value,$expiry);
- }
}
|