Spring-boot application using redis as a caching database

Overview

Java Spring-boot application using Redis as a caching database

Running Application

Entities involved

  • Two main entities are involved
    • MasterHouse (master_houses)
    • Wizard (wizards)
  • Wizards have a many-to-one relationship with MasterHouse
  • Example:
    • Harry Potter (wizard) belongs to Gryffindor (masterHouse)
    • Ron Weasley (wizard) belongs to Gryffindor (masterHouse)
    • Hermione Granger (wizard) belongs to Gryffindor (masterHouse)
    • Griffindor (masterHouse) has Harry Potter, Ron Weasly and Hermione Granger (wizards)

Caching Flow

  • The house id is used as the key and the list of wizards belonging to that particular house are kept as the value in redis DB (key-value store)
  • The key is removed from the cache when a new wizard is added/updated/removed to/from that house
  • When the API is hit again, the updated list value is added to the cache and the process is repeated
  • Addition to that the API to retreive wizard by #id is also cached and goes through the above mentioned process as well where the wizard's pkey is used as a key to store the corresponding DTO value

Main classes/files

Technologies used

  • Java-15
  • Spring-boot
  • PostgreSQL
  • Flyway
  • Redis
  • Open-API(Swagger)
  • Lombok

Setup Locally Without Docker

  • Install Java 15
  • Install Maven
  • Install PostgreSQL
  • Install Redis

Recommended way is to use sdkman for installing both maven and java

Create postgres user (superuser) with name and password as bojack

CREATE USER bojack WITH PASSWORD 'bojack' SUPERUSER;

Create Database with name 'bojack' and assign the above created user to the database with preferable CLI or GUI tool

create database bojack;
grant all privileges on database bojack to bojack;

Start the redis server and specify the port in application.properties file

sudo redis-server path-to/redis.conf

Run the below commands in the core

mvn clean
mvn install

Execute any of the two commands below to run the application

java -jar target/redis-caching-spring-boot-0.0.1-SNAPSHOT.jar
mvn spring-boot:run

The Default port is 9090 (can be changed in application.properties)

Go to the below URI to view Swagger-UI (API-docs)

http://localhost:9090/swagger-ui.html
Owner
Java developer working extensively in spring boot and libraries relating to the java ecosystem.
null
该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的线上博客项目/企业大型商城系统/前后端分离实践项目等,摆脱各种 hello world 入门案例的束缚,真正的掌握 Spring Boot 开发。

Spring Boot Projects 该仓库中主要是 Spring Boot 的入门学习教程以及一些常用的 Spring Boot 实战项目教程,包括 Spring Boot 使用的各种示例代码,同时也包括一些实战项目的项目源码和效果展示,实战项目包括基本的 web 开发以及目前大家普遍使用的前

十三 3.9k Sep 18, 2021
循序渐进,学习Spring Boot、Spring Boot & Shiro、Spring Batch、Spring Cloud、Spring Cloud Alibaba、Spring Security & Spring Security OAuth2,博客Spring系列源码:https://mrbird.cc

Spring 系列教程 该仓库为个人博客https://mrbird.cc中Spring系列源码,包含Spring Boot、Spring Boot & Shiro、Spring Cloud,Spring Boot & Spring Security & Spring Security OAuth2

mrbird 21.6k Sep 13, 2021
Spring Boot Refresh Token using JWT example - Expire and Renew JWT Token

Spring Boot Refresh Token with JWT example Build JWT Refresh Token in the Java Spring Boot Application. You can know how to expire the JWT, then renew

null 40 Sep 3, 2021
:fire: Spring-Boot-Plus is a easy-to-use, high-speed, high-efficient,feature-rich, open source spring boot scaffolding. :rocket:

Everyone can develop projects independently, quickly and efficiently! What is spring-boot-plus? A easy-to-use, high-speed, high-efficient, feature-ric

geekidea 2.2k Sep 8, 2021
Spring-boot application using redis as a caching database

Java Spring-boot application using Redis as a caching database Running Application Entities involved Two main entities are involved MasterHouse (maste

null 10 Jul 28, 2021
Spring Boot Resources

Awesome Spring Boot 收集各种 Spring Boot 学习资源 参与贡献 推荐程序员都关注的一个漫画公众号 关注后,回复:java 获取超过 10万 人领取的 Java 知识体系/面试必看资料。 目录 博客 网站 开源 其它 Spring Boot Starters 列表 博客

纯洁的微笑 3.8k Sep 8, 2021
spring boot 实践学习案例,是 spring boot 初学者及核心技术巩固的最佳实践。另外写博客,用 OpenWrite。

推荐工具: 微信公众号 Markdown 编辑器 - OpenWrite:Markdown 微信编辑器是一款专业强大的微信公众平台在线编辑排版工具,提供手机预览功能,让用户在微信图文 、文章、内容排版、文本编辑、素材编辑上更加方便。 - 更多介绍 博客群发平台 一、支持泥瓦匠 Spring Boot

泥瓦匠BYSocket 14.5k Sep 12, 2021
Spring Boot starter module for gRPC framework.

Spring Boot starter module for gRPC framework.

Michael Zhang 1.8k Mar 17, 2021
Spring Boot starter module for gRPC framework.

Spring Boot starter module for gRPC framework.

Michael Zhang 2.1k Sep 11, 2021
Spring boot microservice example with Eureka Server + Eureka Client + Spring Cloud API Gateway + OAuth2.0 + Circuit Breaker + Resilience4J + FeignClient + RestTemplate

Spring boot microservice example Spring boot microservice example with Eureka Server + Eureka Client + Spring Cloud API Gateway + OAuth2.0 + Circuit B

Subhash Lamba 27 Sep 9, 2021
Universal, flexible, high-performance distributed ID generator

CosId Universal, flexible, high-performance distributed ID generator 中文文档 Introduction CosId aims to provide a universal, flexible and high-performanc

Ahoo Wang 83 Sep 8, 2021
hibernate redis 二级缓存使用 spring boot redis 配置

hibernate-redisson-spring-boot-starter 介绍 使用 Redisson 作为 hibernate redis 二级缓存提供器,redisson-hibernate-53(hibernate-version) 无法使用 spring boot 配置文件创建的 org

null 3 May 17, 2021
基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统

平台简介 芋道,一套全部开源的企业级的快速开发平台,毫无保留给个人及企业免费使用。 有任何问题,或者想要的功能,可以在 Issues 中提给艿艿。 前端采用 vue-element-admin。 后端采用 Spring Boot、MySQL、Redis。 权限认证使用 Spring Security

芋道源码 915 Sep 18, 2021
A Spring Boot Camel boilerplate that aims to consume events from Apache Kafka, process it and send to a PostgreSQL database.

SPRING-BOOT CAMEL BOILERPLATE This is a Spring-Boot Camel Application model that you can use as a reference to study or even to use in your company. I

Bruno Delgado 45 Sep 17, 2021
🦄 开源社区系统:基于 SpringBoot + MyBatis + MySQL + Redis + Kafka + Elasticsearch + Spring Security + ... 并提供详细的开发文档和配套教程。包含帖子、评论、私信、系统通知、点赞、关注、搜索、用户设置、数据统计等模块。

Echo — 开源社区系统 项目上线到服务器之后可能会出现各种各样的 BUG,比如 Elasticsearch 服务启动失败导致搜索模块不可用,但是在本地运行是完全没问题的,所以各位小伙伴可以放心下载部署。 ?? 项目简介 Echo 是一套前后端不分离的开源社区系统,基于目前主流 Java Web

小牛肉 211 Sep 7, 2021
Spring Kurulumundan Başlayarak, Spring IOC ve Dependency Injection, Hibernate, Maven ve Spring Boot Konularına Giriş Yapıyoruz.

Spring Tutorial for Beginners File Directory Apache Tomcat Apache Tomcat - Eclipse Bağlantısı Spring Paketlerinin İndirilmesi ve Projeye Entegrasyonu

İbrahim Can Erdoğan 10 Sep 7, 2021
Spring Cloud 学习案例,服务发现、服务治理、链路追踪、服务监控等

Spring Cloud Examples Spring Cloud 使用的各种示例,以最简单、最实用为标准 Spring Cloud 中文索引 | Spring Boot学习示例代码 | 参与贡献 English | github地址 | 码云地址 推荐程序员都关注的一个漫画公众号 关注后,回复:

纯洁的微笑 5.8k Sep 13, 2021
Spring Boot Jhipster Photo Gallery App

Spring Boot Jhipster Photo Gallery Example Prerequisites Docker 19.03+ Docker Compose 1.25+ Build Docker Image ./mvnw -Pprod jib:dockerBuild clean ver

Şuayb Şimşek 6 Aug 20, 2021
:herb: 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等:pushpin:

欢迎大家留言和PR~ Tip: 技术更新换代太快,本仓库仅做参考,自己的项目具体使用哪个版本还需谨慎思考~(不推荐使用最新的版本,推荐使用(最新-1|2)的版本,会比较稳定) spring-boot-quick 前言   自己很早就想搞一个总的仓库就是将自己平时遇到的和学习到的东西整合在一起,方便后

wangxc 1.8k Sep 11, 2021