Updated FileCache to support options

file cache was updated to support options object
This commit is contained in:
Florian Bouillon 2019-04-16 16:31:00 +02:00
parent cc0fc06cd2
commit 20d4d58a00

View File

@ -30,16 +30,16 @@ class FileCache implements CacheInterface
/**
* Cache Constructor
*
* @param string $folder
* @param integer|\DateInterval $ttl
* @param object $options
*/
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)) {
mkdir($this->folder, 0777, true);
}
$this->ttl = $this->getTTl($ttl);
}
public function get($key, $default = null)