Search code examples
redisspring-data-redis

Can i query directly Redis database (persistent not in-memory) or data is always kept in-memory and requests are executed against the in-memory data?


A simple question about using Redis as a persistent database (not in-memory):

Can I directly query the Redis database from my spring boot application (just like with MySQL or Oracle db) or data should always be loaded in-memory first and requests are to be executed against the in-memory data?

Thanks.


Solution

  • Redis is an in-memory database which you can treat like any other external dependency you may have in your application. Compared with the other databases you mentioned, it does not offer the ability to use SQL to query it, so you must rely on its own commands, which are very specific.

    There are some Java clients you can use to interact with Redis, including Lettuce and Jedis. The commands you send to Redis are executed against the data that Redis itself keep in its own memory.