Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions README.MD

This file was deleted.

22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Example of Local Cache | In-Memory Cache
#### Caching Process:
```
SpringBootCache application => A
SpringBootApp application => B
```

- **A** calls **B**.
- **B** is configured to sleep for 5 seconds.
- **A** gets a response from **B** in 5+ seconds.
<img width="1305" alt="image" src="https://github.com/rahulvaish/SpringBoot-Java/assets/689226/eb8d34a3-8f26-460d-9a80-adc60317a3d5">
- **A** caches the data coming from **B**.
- On hitting **A** again, the response takes < 10 ms as the data is coming from the cache and not actually from **B**.
<img width="1314" alt="image" src="https://github.com/rahulvaish/SpringBoot-Java/assets/689226/1e2bef25-d158-412e-a817-3867f188842e">
- We have also configured a @Scheduler in **A** to keep cleaning the cache after every 20 seconds.
- Therefore, post 20 seconds if we hit **A** again, it gets a response from the **B** in 5+ seconds.

#### NOTE:
- During the period when the cache is holding the data, if **B** is turned off, still **A** gets a response in < 10 ms, as data is being fetched from the cache, and not from **B**.
- Once the cache is cleared, **A** results in a 500 Error - As no data is found in the cache, and **B** is off!


33 changes: 33 additions & 0 deletions SpringBootApp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Binary file added SpringBootApp/.mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions SpringBootApp/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.4/apache-maven-3.9.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
308 changes: 308 additions & 0 deletions SpringBootApp/mvnw

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading