Added proper cache::forever implementations to each driver.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
12
laravel/cache/drivers/apc.php
vendored
12
laravel/cache/drivers/apc.php
vendored
@@ -63,6 +63,18 @@ class APC extends Driver {
|
||||
apc_store($this->key.$key, $value, $minutes * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
12
laravel/cache/drivers/database.php
vendored
12
laravel/cache/drivers/database.php
vendored
@@ -87,6 +87,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.
|
||||
*
|
||||
|
||||
12
laravel/cache/drivers/driver.php
vendored
12
laravel/cache/drivers/driver.php
vendored
@@ -53,18 +53,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.
|
||||
*
|
||||
|
||||
12
laravel/cache/drivers/file.php
vendored
12
laravel/cache/drivers/file.php
vendored
@@ -73,6 +73,18 @@ class File extends Driver {
|
||||
file_put_contents($this->path.$key, $value, LOCK_EX);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
12
laravel/cache/drivers/memcached.php
vendored
12
laravel/cache/drivers/memcached.php
vendored
@@ -71,6 +71,18 @@ class Memcached extends Driver {
|
||||
$this->memcache->set($this->key.$key, $value, 0, $minutes * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
|
||||
14
laravel/cache/drivers/redis.php
vendored
14
laravel/cache/drivers/redis.php
vendored
@@ -60,11 +60,23 @@ 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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user