Skip to content

Java Project to see the basics of redis as a cache system

Notifications You must be signed in to change notification settings

renatompf/poc_spring_redis

Repository files navigation

poc_redis

Description

POC made in Java to learn how to do a project using Redis and learn the basics of this technology. Also used Postgres to handle all the data.

Of course, that cache would only be needed in operations that would take a lot of time to gather from databases, for example. But as told, this was only an example to understand how it works.

In order to test this the procedure was the following:

  1. When starting up the project - by making make run in the terminal - the Postgres database starts, alongside redis and the app itself;
  2. Then there are a couple of endpoints, like getting a user by id (GET /users/{id}), updating a user (PUT /users/{id}), and delete a user (DELETE /users/{id}) that make alterations to the cache;

How to check the alterations in the cache?

After starting the whole project and making the endpoint calls that are referred, you can make the following:

  1. Go to your redis container (Check the container id by doing docker ps and then make
    docker exec -it <docker container id> bash);
  2. Once inside the container you can start the redis client (run redis-cli);
  3. And last you can check all the keys and values you want by making keys '*' and
    get users::{userid} and you will see the respective objects and follow the changes when calling the endpoints;

How to run it:

To run it you can simply make the following command:

make run

and to stop the application:

make stop

About

Java Project to see the basics of redis as a cache system

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published