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

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs