Commit 2f4d8969 by Taylor Otwell

Added proper cache::forever implementations to each driver.

Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
parent 873dd153
......@@ -64,6 +64,18 @@ class APC extends Driver {
}
/**
* Write an item to the cache that lasts forever.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
return $this->put($key, $value, 0);
}
/**
* Delete an item from the cache.
*
* @param string $key
......
......@@ -88,6 +88,18 @@ class Database extends Driver {
}
/**
* Write an item to the cache for five years.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
return $this->put($key, $value, 2628000);
}
/**
* Delete an item from the cache.
*
* @param string $key
......
......@@ -54,18 +54,6 @@ abstract class Driver {
abstract public function put($key, $value, $minutes);
/**
* Write an item to the cache for five years.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
return $this->put($key, $value, 2628000);
}
/**
* Get an item from the cache, or cache and return the default value.
*
* <code>
......
......@@ -74,6 +74,18 @@ class File extends Driver {
}
/**
* Write an item to the cache for five years.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
return $this->put($key, $value, 2628000);
}
/**
* Delete an item from the cache.
*
* @param string $key
......
......@@ -72,6 +72,18 @@ class Memcached extends Driver {
}
/**
* Write an item to the cache that lasts forever.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
return $this->put($key, $value, 0);
}
/**
* Delete an item from the cache.
*
* @param string $key
......
......@@ -60,12 +60,24 @@ class Redis extends Driver {
*/
public function put($key, $value, $minutes)
{
$this->redis->set($key, serialize($value));
$this->forever($key, $value);
$this->redis->expire($key, $minutes * 60);
}
/**
* Write an item to the cache that lasts forever.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function forever($key, $value)
{
$this->redis->set($key, serialize($value));
}
/**
* Delete an item from the cache.
*
* @param string $key
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment