mirror of
https://github.com/getgrav/grav.git
synced 2026-05-09 00:37:13 +02:00
Added a configuration option to set a default lifetime on cache saves
This commit is contained in:
@@ -27,6 +27,7 @@ cache:
|
||||
method: file # Method to check for updates in pages: file|folder|none
|
||||
driver: auto # One of: auto|file|apc|xcache|memcache|wincache
|
||||
prefix: 'g' # Cache prefix string (prevents cache conflicts)
|
||||
lifetime: 86400 # Lifetime of cached data in seconds (0 = infinite)
|
||||
|
||||
twig:
|
||||
cache: true # Set to true to enable twig caching
|
||||
|
||||
@@ -154,6 +154,10 @@ class Cache extends Getters
|
||||
public function save($id, $data, $lifetime = null)
|
||||
{
|
||||
if ($this->enabled) {
|
||||
|
||||
if ($lifetime == null) {
|
||||
$lifetime = $this->config->get('system.cache.lifetime') ?: null;
|
||||
}
|
||||
$this->driver->save($id, $data, $lifetime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user