diff --git a/lib/Cake/Cache/Engine/RedisEngine.php b/lib/Cake/Cache/Engine/RedisEngine.php index bf735d26a06..b8bdd4c0d92 100644 --- a/lib/Cake/Cache/Engine/RedisEngine.php +++ b/lib/Cake/Cache/Engine/RedisEngine.php @@ -239,6 +239,10 @@ public function __destruct() { * @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) {