public save ( mixed $data_to_cache, string $cache_id, string $cache_group = 'global', $expiration = false ) : boolean | ||
$data_to_cache | mixed | your data, anything that can be serialized |
$cache_id | string | id of the cache, you must define it because you will use it later to retrieve the cached content. |
$cache_group | string | (default is 'global') - this is the subfolder in the cache dir. |
Résultat | boolean |
public function save($data_to_cache, $cache_id, $cache_group = 'global', $expiration = false)
{
if (!$this->support_tags) {
return;
}
$cache_group = $this->cache_group($cache_group);
if ($expiration != false) {
Cache::tags($cache_group)->put($cache_id, $data_to_cache, intval($expiration));
} else {
Cache::tags($cache_group)->put($cache_id, $data_to_cache, $this->ttl);
}
}