> ## Documentation Index
> Fetch the complete documentation index at: https://help.pixwel.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Caching

# Caching

Pixwel uses Redis to cache various things. This is supplied by the [Cacheable behaviour trait](https://github.com/Pixwel/platform/blob/2.x/api/models/behavior/Cacheable.php) 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:

```bash theme={null}
# Install Redis tools
sudo apt-get install redis-tools
# Connect to the cache
redis-cli -h $redis_host
```

Sometimes after restoring or changing data your local cache will be stale, e.g. `$links` will appear empty or not include the watermark. Clear your local Redis with:

```bash theme={null}
docker-compose exec redis redis-cli FLUSHALL
```

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`](http://redis.io/commands/del) in `redis-cli` should work fine)

See also:

* [Pixwel API - troubleshooting](/api/troubleshooting) - API troubleshooting has some notes on Redis.
* [Redis command reference](http://redis.io/commands)

***

[Back to docs index](/) | [Next page in recommended reading order >>](/flags)
