mirror of
https://github.com/beestat/app.git
synced 2026-05-13 10:52:29 -04:00
Added settings page and all the things that go along with it.
This commit is contained in:
@@ -57,6 +57,28 @@ class api_cache extends crud {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cache for a specific API call.
|
||||
*
|
||||
* @param $api_call The API call to clear the cache for.
|
||||
*
|
||||
* @return mixed The updated cache row or null if it wasn't cached.
|
||||
*/
|
||||
public function clear_cache($api_call) {
|
||||
$key = $this->generate_key($api_call);
|
||||
$cache_hits = $this->read(['key' => $key]);
|
||||
|
||||
if(count($cache_hits) > 0) {
|
||||
$cache_hit = $cache_hits[0];
|
||||
$attributes = [];
|
||||
$attributes['expires_at'] = date('Y-m-d H:i:s', strtotime('1970-01-01 00:00:01'));
|
||||
$attributes['api_cache_id'] = $cache_hit['api_cache_id'];
|
||||
return $this->update($attributes);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a cache entry with a matching key that is not expired.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user