You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{name} is a cache abstraction for the Java ecosystem that leverages enterprise Redis features like indexing and query.
19
+
{project-title} is a cache abstraction for the Java ecosystem that leverages enterprise Redis features like indexing and query.
18
20
It provides an implementation of Spring Framework's https://docs.spring.io/spring-framework/reference/6.1/integration.html#cache[Cache Abstraction].
19
21
22
+
toc::[]
23
+
24
+
== Quick Start
25
+
26
+
To understand how {project-title} works, it's best to try it for yourself.
27
+
28
+
This example showcases a Spring Boot application using {project-title}.
29
+
30
+
First, clone this git repository:
31
+
32
+
[source,console,subs="verbatim,attributes"]
33
+
----
34
+
git clone {project-url}.git
35
+
cd {project-dist}
36
+
----
37
+
38
+
Next, register and create an API read-access token at https://developer.themoviedb.org/docs/getting-started[themoviedb.org,window=tmdb].
39
+
40
+
Set the following environment variable with the token:
41
+
42
+
[source,console]
43
+
----
44
+
export TMDB_TOKEN=<your API read-access token>
45
+
----
46
+
47
+
Finally use Docker Compose to launch containers for Redis and the {project-title} demo app instance:
48
+
49
+
[source,console]
50
+
----
51
+
docker compose up
52
+
----
53
+
54
+
// tag::demoSteps[]
55
+
56
+
You can access the demo at http://localhost:8080/[http://localhost:8080,window=demo].
57
+
58
+
As you click around on the different pages, notice how the response time improves after the first time you request a page.
59
+
60
+
image:redis-cache-demo.png[]
61
+
62
+
Open another browser window and access the http://localhost:3000/d/1[Grafana dashboard,window=grafana].
63
+
Use username/password `admin`/`admin` to log in.
64
+
You can skip changing password.
65
+
66
+
Arrange your browser windows with the demo app on the left and Grafana on the right:
67
+
68
+
image:redis-cache-demo-grafana.png[]
69
+
70
+
Notice the HTTP response time decreasing with cache hits, and increasing with API requests.
71
+
72
+
Now click on the http://localhost:8080/movies/search[Search,window=demo] link to search the cache, for example with keyword `corleone`.
73
+
74
+
Notice how quickly search results are returned: the search feature is powered by Redis.
75
+
76
+
Search response time can be visualized with the panel at the bottom of the Grafana dashboard.
77
+
78
+
image:redis-cache-demo-search.png[]
79
+
80
+
// end::demoSteps[]
81
+
20
82
== Usage
21
83
22
84
=== Dependency
@@ -43,7 +105,7 @@ dependencies {
43
105
44
106
=== Setup
45
107
46
-
To use {name} as a backing implementation, add `RedisCacheManager` to your configuration as follows:
108
+
To use {project-title} as a backing implementation, add `RedisCacheManager` to your configuration as follows:
47
109
48
110
[source,java]
49
111
-----
@@ -53,6 +115,17 @@ public RedisCacheManager cacheManager(RedisModulesClient client) {
53
115
}
54
116
-----
55
117
118
+
Then you can tag the methods in your application that you want to apply caching to.
119
+
120
+
.Cached Method Example
121
+
[source,java]
122
+
----
123
+
@Cacheable("popular")
124
+
public List<MovieDb> fetchPopularMovies(int page) throws Exception {
125
+
return tmdbService.fetchPopularMovies(page);
126
+
}
127
+
----
128
+
56
129
`RedisCacheManager` behavior can be configured with `RedisCacheManagerBuilder`, letting you set the default `RedisCacheConfiguration` and predefined caches.
57
130
58
131
[source,java]
@@ -120,7 +193,7 @@ See the https://github.com/ben-manes/caffeine/wiki[Caffeine Documentation] for m
120
193
121
194
==== Metrics
122
195
123
-
{name} uses Micrometer to publish metrics.
196
+
{project-title} uses Micrometer to publish metrics.
124
197
To enable metrics, set a `MeterRegistry` in your `RedisCacheConfiguration`:
125
198
126
199
[source,java]
@@ -179,65 +252,11 @@ The following metrics are published:
179
252
180
253
NOTE: All metrics expose their corresponding cache name as a tag: `name=<cache>`.
181
254
182
-
== Quick Start
183
-
184
-
To understand how {name} works, it's best to try it for yourself.
185
-
186
-
This example showcases a Spring Boot application using {name}.
187
-
188
-
First, clone this git repository:
189
-
190
-
[source,console,subs="verbatim,attributes"]
191
-
----
192
-
git clone {project-url}.git
193
-
cd {dist-repo}
194
-
----
195
-
196
-
Next, register and create an API read-access token at https://developer.themoviedb.org/docs/getting-started[themoviedb.org].
197
-
198
-
Set the following environment variable with the token:
199
-
200
-
[source,console]
201
-
----
202
-
export TMDB_TOKEN=<your API read-access token>
203
-
----
204
-
205
-
Finally use Docker Compose to launch containers for Redis and the {name} demo app instance:
206
-
207
-
[source,console]
208
-
----
209
-
docker compose up
210
-
----
211
-
212
-
You can then access the demo at http://localhost:8080/[localhost:8080].
213
-
214
-
As you click around on the different pages, notice how the response time improves after the first time you request a page.
215
-
216
-
image:redis-cache-demo.png[]
217
-
218
-
Open another browser window and access Grafana at http://localhost:3000/[localhost:3000].
219
-
Use username/password `admin`/`admin` to log in.
220
-
You can skip changing password.
221
-
222
-
Arrange your browser windows with the demo app on the left and Grafana on the right:
223
-
224
-
image:redis-cache-demo-grafana.png[]
225
-
226
-
Notice the HTTP response time decreasing with cache hits, and increasing with API requests.
227
-
228
-
Now click on the http://localhost:8080/movies/search[Search] link to search the cache, for example with keyword `corleone`.
229
-
230
-
Notice how quickly search results are returned: the search feature is powered by Redis.
231
-
232
-
Search response time can be visualized with the panel at the bottom of the Grafana dashboard.
233
-
234
-
image:redis-cache-demo-search.png[]
235
-
236
255
== Support
237
256
238
-
{name} is supported by Redis, Inc. for enterprise-tier customers as a 'Developer Tool' under the https://redis.io/legal/software-support-policy/[Redis Software Support Policy.] For non enterprise-tier customers we supply support for {name} on a good-faith basis.
239
-
To report bugs, request features, or receive assistance, please https://github.com/{project-owner}/{dist-repo}/issues[file an issue].
257
+
{project-title} is supported by Redis, Inc. for enterprise-tier customers as a 'Developer Tool' under the https://redis.io/legal/software-support-policy/[Redis Software Support Policy.] For non enterprise-tier customers we supply support for {project-title} on a good-faith basis.
258
+
To report bugs, request features, or receive assistance, please {project-url}/issues[file an issue].
240
259
241
260
== License
242
261
243
-
{name} is licensed under the Business Source License 1.1. Copyright (C) 2024 Redis, Inc. See https://github.com/redis-field-engineering/{dist-repo}/blob/main/LICENSE.md[LICENSE] for details.
262
+
{project-title} is licensed under the Business Source License 1.1. Copyright (C) 2024 Redis, Inc. See {project-url}/blob/main/LICENSE.md[LICENSE] for details.
0 commit comments