skip to Main Content

In my application I am implementing a server-side cache using Redis (for mySQL database). When data change in the database, I want to completely clear the cache to invalidate the old data.

However, I would like to see some statistics about how often are different keys queried in Redis, so that I can sort of manually pre-fetch frequently queried data for them to be available immediately after clearing the cache.

Is there any way how to see these statistics directly in Redis? Or what is a common solution to this problem?

2

Answers


  1. You can use the object command.

    OBJECT FREQ returns the logarithmic access frequency counter of
    the object stored at the specified key. This subcommand is available
    when maxmemory-policy is set to an LFU policy.

    https://redis.io/commands/object

    Login or Signup to reply.
  2. redis-cli --hotkeys can do the help for redis-cli version 4.x and above.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search