mirror of
https://github.com/Aviortheking/DeltaCMS.git
synced 2025-04-22 19:02:12 +00:00
Updated FileCache to support options
file cache was updated to support options object
This commit is contained in:
parent
cc0fc06cd2
commit
20d4d58a00
@ -30,16 +30,16 @@ class FileCache implements CacheInterface
|
|||||||
/**
|
/**
|
||||||
* Cache Constructor
|
* Cache Constructor
|
||||||
*
|
*
|
||||||
* @param string $folder
|
* @param object $options
|
||||||
* @param integer|\DateInterval $ttl
|
|
||||||
*/
|
*/
|
||||||
public function __construct(string $folder = "./cache", $ttl = 86400)
|
public function __construct(object $options)
|
||||||
{
|
{
|
||||||
$this->folder = $folder;
|
$this->folder = isset($options->path) ? $options->path . "/" . "fs/" : "./cache";
|
||||||
|
// dd($this->folder);
|
||||||
|
$this->ttl = $this->getTTL(isset($options->ttl) ? $options->ttl : 86400);
|
||||||
if (!file_exists($this->folder)) {
|
if (!file_exists($this->folder)) {
|
||||||
mkdir($this->folder, 0777, true);
|
mkdir($this->folder, 0777, true);
|
||||||
}
|
}
|
||||||
$this->ttl = $this->getTTl($ttl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get($key, $default = null)
|
public function get($key, $default = null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user