public function save($key, $value, $ttl = 259200, $tags = NULL)
{
$ttl = intval($ttl);
if ($ttl > 0) {
if (is_scalar($value)) {
$set = $this->redis->SetEX($this->prefix . $key, $ttl, $value);
$this->setKeySerialization(false, $key, $ttl);
} else {
$set = $this->redis->SetEX($this->prefix . $key, $ttl, serialize($value));
$this->setKeySerialization(true, $key, $ttl);
}
} else {
if (is_scalar($value)) {
$set = $this->redis->Set($this->prefix . $key, $value);
$this->setKeySerialization(false, $key, 0);
} else {
$set = $this->redis->Set($this->prefix . $key, serialize($value));
$this->setKeySerialization(true, $key, $ttl);
}
}
if (!$set) {
return false;
}
if (!empty($tags)) {
$this->setTags($key, $tags);
}
return true;
}