Skip to content

Commit

Permalink
Trying to use XCahe for common framework caching result in error message
Browse files Browse the repository at this point in the history
"Use serialize before xcache_set". Fixed.
  • Loading branch information
SmiSoft committed Mar 5, 2016
1 parent 88e1bb8 commit 1200f86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Cache/Engine/XcacheEngine.php
Expand Up @@ -80,7 +80,7 @@ public function write($key, $value)
$duration = $this->_config['duration'];
$expires = time() + $duration;
xcache_set($key . '_expires', $expires, $duration);
return xcache_set($key, $value, $duration);
return xcache_set($key, serialize($value), $duration);
}

/**
Expand All @@ -100,7 +100,7 @@ public function read($key)
if ($cachetime < $time || ($time + $this->_config['duration']) < $cachetime) {
return false;
}
return xcache_get($key);
return unserialize(xcache_get($key));
}
return false;
}
Expand Down

0 comments on commit 1200f86

Please sign in to comment.