├── .gitignore
├── README.md
├── redis-performance
├── .gitignore
├── docker-compose.yaml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── vinsguru
│ │ │ └── redisperformance
│ │ │ ├── RedisPerformanceApplication.java
│ │ │ ├── controller
│ │ │ ├── BusinessMetricsController.java
│ │ │ ├── ProductControllerV1.java
│ │ │ └── ProductControllerV2.java
│ │ │ ├── entity
│ │ │ └── Product.java
│ │ │ ├── repository
│ │ │ └── ProductRepository.java
│ │ │ └── service
│ │ │ ├── BusinessMetricsService.java
│ │ │ ├── DataSetupService.java
│ │ │ ├── ProductServiceV1.java
│ │ │ ├── ProductServiceV2.java
│ │ │ ├── ProductVisitService.java
│ │ │ └── util
│ │ │ ├── CacheTemplate.java
│ │ │ ├── ProductCacheTemplate.java
│ │ │ └── ProductLocalCacheTemplate.java
│ └── resources
│ │ ├── application.properties
│ │ └── schema.sql
│ └── test
│ └── java
│ └── com
│ └── vinsguru
│ └── redisperformance
│ └── RedisPerformanceApplicationTests.java
├── redis-spring
├── .gitignore
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── vinsguru
│ │ │ └── redisspring
│ │ │ ├── RedisSpringApplication.java
│ │ │ ├── chat
│ │ │ ├── config
│ │ │ │ └── ChatRoomSocketConfig.java
│ │ │ └── service
│ │ │ │ └── ChatRoomService.java
│ │ │ ├── city
│ │ │ ├── client
│ │ │ │ └── CityClient.java
│ │ │ ├── controller
│ │ │ │ └── CityController.java
│ │ │ ├── dto
│ │ │ │ └── City.java
│ │ │ └── service
│ │ │ │ └── CityService.java
│ │ │ ├── fib
│ │ │ ├── config
│ │ │ │ └── RedissonCacheConfig.java
│ │ │ ├── controller
│ │ │ │ └── FibController.java
│ │ │ └── service
│ │ │ │ └── FibService.java
│ │ │ ├── geo
│ │ │ ├── controller
│ │ │ │ └── RestaurantController.java
│ │ │ ├── dto
│ │ │ │ ├── GeoLocation.java
│ │ │ │ └── Restaurant.java
│ │ │ ├── service
│ │ │ │ ├── DataSetupService.java
│ │ │ │ └── RestaurantLocatorService.java
│ │ │ └── util
│ │ │ │ └── RestaurantUtil.java
│ │ │ └── weather
│ │ │ ├── controller
│ │ │ └── WeatherController.java
│ │ │ └── service
│ │ │ ├── ExternalServiceClient.java
│ │ │ └── WeatherService.java
│ └── resources
│ │ ├── application.properties
│ │ ├── restaurant.json
│ │ └── static
│ │ ├── geo.html
│ │ └── index.html
│ └── test
│ └── java
│ └── com
│ └── vinsguru
│ └── redisspring
│ └── RedisSpringApplicationTests.java
└── redisson-playground
├── pom.xml
└── src
└── test
├── java
└── com
│ └── vinsguru
│ └── redisson
│ └── test
│ ├── BaseTest.java
│ ├── Lec01KeyValueTest.java
│ ├── Lec02KeyValueObjectTest.java
│ ├── Lec03NumberTest.java
│ ├── Lec04BucketAsMapTest.java
│ ├── Lec05EventListenerTest.java
│ ├── Lec06MapTest.java
│ ├── Lec07MapCacheTest.java
│ ├── Lec08LocalCachedMapTest.java
│ ├── Lec09ListQueueStackTest.java
│ ├── Lec10MessageQueueTest.java
│ ├── Lec11HyperLogLogTest.java
│ ├── Lec12PubSubTest.java
│ ├── Lec13BatchTest.java
│ ├── Lec14TransactionTest.java
│ ├── Lec15SortedSetTest.java
│ ├── Lec16PriorityQueueTest.java
│ ├── Lec17GeoSpatialTest.java
│ ├── assignment
│ ├── Category.java
│ ├── PriorityQueue.java
│ └── UserOrder.java
│ ├── config
│ └── RedissonConfig.java
│ ├── dto
│ ├── GeoLocation.java
│ ├── Restaurant.java
│ └── Student.java
│ └── util
│ └── RestaurantUtil.java
└── resources
└── restaurant.json
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Java template
2 | # Compiled class file
3 | **/*.class
4 |
5 | # Log file
6 | **/*.log
7 |
8 | # BlueJ files
9 | **/*.ctxt
10 |
11 | # Mobile Tools for Java (J2ME)
12 | **/.mtj.tmp/
13 |
14 | # Package Files #
15 | **/*.jar
16 | **/*.war
17 | **/*.nar
18 | **/*.ear
19 | **/*.zip
20 | **/*.tar.gz
21 | **/*.rar
22 |
23 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
24 | **/hs_err_pid*
25 |
26 | ### Maven template
27 | **/target/
28 | **/pom.xml.tag
29 | **/pom.xml.releaseBackup
30 | **/pom.xml.versionsBackup
31 | **/pom.xml.next
32 | **/release.properties
33 | **/dependency-reduced-pom.xml
34 | **/buildNumber.properties
35 | **/.mvn/timing.properties
36 | **/.mvn/wrapper/maven-wrapper.jar
37 |
38 | **/*.iml
39 |
40 | **/.idea/
41 |
42 |
43 | **/HELP.md
44 | **/.mvn/
45 | **/mvnw
46 | **/mvnw.cmd
47 | **/node_modules/
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # redis-webflux
2 |
3 | This repository contains the code samples for my Udemy Course on Redis With Spring WebFlux
4 |
--------------------------------------------------------------------------------
/redis-performance/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
--------------------------------------------------------------------------------
/redis-performance/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: "3"
2 | services:
3 | postgres:
4 | image: postgres
5 | container_name: postgres
6 | environment:
7 | - POSTGRES_USER=postgres
8 | - POSTGRES_PASSWORD=postgres
9 | ports:
10 | - "5432:5432"
11 | pgadmin:
12 | image: dpage/pgadmin4
13 | container_name: pgadmin
14 | environment:
15 | - PGADMIN_DEFAULT_EMAIL=admin@admin.com
16 | - PGADMIN_DEFAULT_PASSWORD=admin
17 | ports:
18 | - "9000:80"
19 | redis:
20 | image: redis
21 | ports:
22 | - "6379:6379"
--------------------------------------------------------------------------------
/redis-performance/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 3.5.0
9 |
10 |
11 | com.vinsguru
12 | redis-performance
13 | 0.0.1-SNAPSHOT
14 | redis-performance
15 | Demo project for Spring Boot
16 |
17 | 21
18 | 3.47.0
19 |
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-data-r2dbc
24 |
25 |
26 | org.redisson
27 | redisson-spring-boot-starter
28 | ${redisson.spring.version}
29 |
30 |
31 | org.springframework.boot
32 | spring-boot-starter-web
33 |
34 |
35 |
36 |
37 | org.springframework.boot
38 | spring-boot-starter-webflux
39 |
40 |
41 |
42 | org.postgresql
43 | postgresql
44 | runtime
45 |
46 |
47 | org.postgresql
48 | r2dbc-postgresql
49 | runtime
50 |
51 |
52 | org.projectlombok
53 | lombok
54 | true
55 |
56 |
57 | org.springframework.boot
58 | spring-boot-starter-test
59 | test
60 |
61 |
62 | io.projectreactor
63 | reactor-test
64 | test
65 |
66 |
67 |
68 |
69 |
70 |
71 | org.springframework.boot
72 | spring-boot-maven-plugin
73 |
74 |
75 |
76 | org.projectlombok
77 | lombok
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/redis-performance/src/main/java/com/vinsguru/redisperformance/RedisPerformanceApplication.java:
--------------------------------------------------------------------------------
1 | package com.vinsguru.redisperformance;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class RedisPerformanceApplication {
8 |
9 | public static void main(String[] args) {
10 | SpringApplication.run(RedisPerformanceApplication.class, args);
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/redis-performance/src/main/java/com/vinsguru/redisperformance/controller/BusinessMetricsController.java:
--------------------------------------------------------------------------------
1 | package com.vinsguru.redisperformance.controller;
2 |
3 | import com.vinsguru.redisperformance.service.BusinessMetricsService;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.http.MediaType;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.RequestMapping;
8 | import org.springframework.web.bind.annotation.RestController;
9 | import reactor.core.publisher.Flux;
10 |
11 | import java.time.Duration;
12 | import java.util.Map;
13 |
14 | @RestController
15 | @RequestMapping("product/metrics")
16 | public class BusinessMetricsController {
17 |
18 | @Autowired
19 | private BusinessMetricsService metricsService;
20 |
21 | @GetMapping(produces = MediaType.TEXT_EVENT_STREAM_VALUE)
22 | public Flux