Add forever and flush methods to memory driver.
Signed-off-by: Taylor Otwell <taylorotwell@gmail.com>
This commit is contained in:
22
laravel/cache/drivers/memory.php
vendored
22
laravel/cache/drivers/memory.php
vendored
@@ -52,6 +52,18 @@ class Memory extends Driver {
|
|||||||
$this->storage[$key] = $value;
|
$this->storage[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write an item to the cache that lasts forever.
|
||||||
|
*
|
||||||
|
* @param string $key
|
||||||
|
* @param mixed $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function forever($key, $value)
|
||||||
|
{
|
||||||
|
$this->put($key, $value, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete an item from the cache.
|
* Delete an item from the cache.
|
||||||
*
|
*
|
||||||
@@ -63,4 +75,14 @@ class Memory extends Driver {
|
|||||||
unset($this->storage[$key]);
|
unset($this->storage[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flush the entire cache.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function flush()
|
||||||
|
{
|
||||||
|
$this->stroage = array();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user