mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Data must be serialized before being written
Data is unserialized by redis engine on read, so we have to serialized on write.
This commit is contained in:
parent
d6251eff19
commit
67585d6fe1
1 changed files with 4 additions and 0 deletions
|
@ -239,6 +239,10 @@ class RedisEngine extends CacheEngine {
|
|||
* @link https://github.com/phpredis/phpredis#setnx
|
||||
*/
|
||||
public function add($key, $value, $duration) {
|
||||
if (!is_int($value)) {
|
||||
$value = serialize($value);
|
||||
}
|
||||
|
||||
$result = $this->_Redis->setnx($key, $value);
|
||||
// setnx() doesn't have an expiry option, so overwrite the key with one
|
||||
if ($result) {
|
||||
|
|
Loading…
Reference in a new issue