6 The cache component¶
6.1 Setup¶
The settings should be injected with the setConfig. It is structured as follows:
$cache->setConfig([
'servers' => [
['host' => '127.0.0.1', 'port' => 11211]
],
'options' => [
// Cache driver specific options
],
'persistent_id' => 'ting.test' // Memcache persistent id
]);
6.2 Save into cache¶
$cache->store($key, $value, $ttl);
6.3 Save several values into the cache¶
$cache->storeMulti($associativeArray, $ttl);
6.4 Delete a value from the cache¶
$cache->delete($key);
6.5 Delete several values from the cache¶
$cache->deleteMulti($keys);
6.6 Update a value in the cache¶
$cache->replace($key, $value, $ttl);
6.7 Save with infinite time to live¶
Put a 0 ttl for infinite Cache