Skip to content

Commit 71bdf2c

Browse files
authored
Merge pull request #121 from hazelcast-guides/TomaszGaweda-patch-1
Minor tutorial tweaks [DEX-298]
2 parents 932d420 + 615dc74 commit 71bdf2c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

docs/modules/ROOT/pages/caching-springboot.adoc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Cache with Spring Boot and Hazelcast
1+
= Cache with Spring Boot and Hazelcast Cache Manager
22
:templates-url: templates:ROOT:page$/
33
:page-layout: tutorial
44
:page-product: imdg
@@ -15,16 +15,16 @@
1515

1616
== Before you Begin
1717

18-
- JDK 1.8+
19-
- Apache Maven 3.2+
18+
- JDK 17+
19+
- Apache Maven 3.8+
2020

2121
== Spring Boot Application
2222

2323
To use caching in your Spring Boot application, you need to:
2424

2525
- add `org.springframework.boot:spring-boot-starter-cache` dependency
26-
- add `@EnableCaching` annotation to your main class
27-
- add `@Cacheable("books")` annotation to every method you want to cache
26+
- add `@EnableCaching` annotation to your main configuration class
27+
- add `@Cacheable("X")` annotation to every method you want to cache, where X will be the name of the cache - eg. "books"
2828

2929
For more explanation on the Spring Boot cache topic, please check the official Spring Guide: https://spring.io/guides/gs/caching/[Caching Data with Spring].
3030

@@ -85,7 +85,8 @@ We want to use Hazelcast as the cache manager. The good news is that all you hav
8585
----
8686
<dependency>
8787
<groupId>com.hazelcast</groupId>
88-
<artifactId>hazelcast-all</artifactId>
88+
<artifactId>hazelcast</artifactId>
89+
<version>5.5.0</version>
8990
</dependency>
9091
----
9192

@@ -130,15 +131,17 @@ Members {size:1, ver:1} [
130131
You can test the application by executing the following command:
131132

132133
----
133-
curl localhost:8080/books/12345
134+
curl -w '\nTotal: %{time_total}s\n' localhost:8080/books/12345
134135
Sample Book Name
136+
Total: 3.090784s
135137
----
136138

137139
The first time you execute this command, it should take some time to get the response. However, when you try it again, it should be instant. That means that the cache is used.
138140

139141
----
140-
curl localhost:8080/books/12345
142+
curl -w '\nTotal: %{time_total}s\n' localhost:8080/books/12345
141143
Sample Book Name
144+
Total: 0.009667s
142145
----
143146

144147
== See Also

0 commit comments

Comments
 (0)