DEV Community

StuartCreed
StuartCreed

Posted on

Some useful points when caching with Redis in a Laravel app

Generic redis db use is done in keyspace (db) 0 and the caching is done in keyspace (db) 1.

image

Once in the redis-cli to select a specific keyspace (db) use the select command e.g. select 1.

Use the KEYS * command to show all of the keys in that key space (db).

Then to view the value associated to a key in that keyspace type the following: MGET enterkeyhere

Redis-cli command to monitor all requests to the redis server is: MONITOR.

Redis-cli command to clear out a redis keyspace/db is: FLUSHALL.

Note that the network tab will not tell you that a response has been taken from a redis cache. E.g. the first is with a redis cache and the second is after a FLUSHALL.
image

Note that if a browser is using its own caching it is shown in the size column of the network tab (disk or memory cache):
image

Top comments (0)