That... Could have gone better

This commit is contained in:
Pablo Ferreiro 2022-03-11 23:18:26 +01:00
parent 605e204453
commit c62df9d631
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
11 changed files with 32 additions and 39 deletions

View file

@ -24,6 +24,11 @@ class JSONCache {
return false;
}
public function exists(string $cache_key): bool {
$filename = $this->cache_path . '/' . $cache_key . '.json';
return is_file($filename);
}
public function set(string $cache_key, mixed $data, $timeout = 3600) {
file_put_contents($this->cache_path . '/' . $cache_key . '.json', json_encode([
'data' => $data,