Skip to main content

Caching

Pixwel uses Redis to cache various things. This is supplied by the Cacheable behaviour trait which uses Li3’s Redis cache adapter. All of the model classes include this trait. At the time of writing, the main things we cache include:
  1. $permissions collection - to save an expensive DB lookup through the somewhat complex permissions list, Permissions model caches.

Manipulating the cache

SSH in to one of the production nodes (Redis is locked down to only talk to the VPC) then:
# Install Redis tools
sudo apt-get install redis-tools
# Connect to the cache
redis-cli -h $redis_host
Sometimes on restoring or changing data the cache on your local Vagrant environment will be stale, e.g. $links will appear empty or not include watermark. You can clear your local redis with:
vagrant@vagrant-gavin:~$ redis-cli
127.0.0.1:6379> FLUSHALL
OK
On the live env, you should clear the cache for individual items rather than blow it away:
[16:48] wms: For future reference, telnet to the Redis server and issue `DEL objectId`
[16:49] wms: eg `DEL 54b8a16fa57d23fb4c8b4577`
[16:49] wms: You should get a response like `:1` (1 key deleted)
(you don’t have to use telnet, this is just an example, DEL in redis-cli should work fine)
See also:
Back to docs index | Next page in recommended reading order >>