bygui86 / spring-redis

Spring Boot Redis sample project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spring Boot Redis sample project

Sub-projects

Spring Boot Redis sample projects:

  • Redis as DB - Spring Data Redis
  • Redis for caching - Spring Caching
  • Messaging with Redis - Spring Data Redis

Prerequisites

  • docker
  • curl / httpie / postman

Run sample

Start Redis

docker run -d --rm --name redis -p 6379:6379 redis:alpine redis-server --appendonly yes

Start application

cd <PROJECT_ROOT_FOLDER>/<SUB_PROJECT_FOLDER>
mvnw clean package spring-boot:run

Now you can call the exposed endpoints.

PLEASE NOTE: A bench of sample data are loading automatically in the DB.


Exposed endpoints

  • Redis as DB

    • GET /posts --> Get all posts
    • GET /posts/{id} --> Get post by id
    • POST /posts --> Insert new post
    • PUT /posts --> Update existing post
    • DELETE /posts --> Delete all posts
    • DELETE /posts/{id} --> Delete post by id
  • Redis for caching

    • GET /posts --> Get all posts
    • GET /posts/{id} --> Get post by id
    • POST /posts --> Insert new post
    • PUT /posts --> Update existing post
    • DELETE /posts --> Delete all posts
    • DELETE /posts/{id} --> Delete post by id
    • GET /cache --> Get all cache keys
    • GET /cache/{key} --> Get cache by key
    • DELETE /cache --> Evict whole cache
    • DELETE /cache/{key} --> Evict cache by key

PLEASE NOTE: URL root http://localhost:8080 PLEASE NOTE: Messaging with Redis does not expose any endpoint, it's a simple batch application


Links

Redis as DB

Redis for caching

Messaging with Redis

Redis

Others

About

Spring Boot Redis sample project

License:Apache License 2.0


Languages

Language:Java 100.0%