config/cache.py
file. In this file, you can specify different cache stores with a name via the STORES
dictionary and the default to use in your application with the default
key.local
.Memcached
or Redis
.storage/framework/cache
in projet root directory but can be changed with location
parameter.redis
python package, that you can install with:pymemcache
python package, that you can install with:add
and put
.add
method. This will either fetch the data already in the cache, if it is not expired, or it will insert the new value.age
key exists in the cache AND it is not expired, then "21" will be added to the cache and returned. If the age
key does not exist or is not expired then it will return whatever data is in the cache for that key.put
method will put data into the cache regardless of if it exists already. This is a good way to overwrite data in the cache:None
to keep the data forever.None
or the default you specify:40
.