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.
17
+
{project-title} is a cache abstraction for the Java ecosystem that leverages enterprise Redis features like indexing and query.
18
18
It provides an implementation of Spring Framework's https://docs.spring.io/spring-framework/reference/6.1/integration.html#cache[Cache Abstraction].
19
19
20
+
== Quick Start
21
+
22
+
To understand how {project-title} works, it's best to try it for yourself.
23
+
24
+
This example showcases a Spring Boot application using {project-title}.
25
+
26
+
First, clone this git repository:
27
+
28
+
[source,console,subs="verbatim,attributes"]
29
+
----
30
+
git clone {project-url}.git
31
+
cd {project-dist}
32
+
----
33
+
34
+
Next, register and create an API read-access token at https://developer.themoviedb.org/docs/getting-started[themoviedb.org,window=tmdb].
35
+
36
+
Set the following environment variable with the token:
37
+
38
+
[source,console]
39
+
----
40
+
export TMDB_TOKEN=<your API read-access token>
41
+
----
42
+
43
+
Finally use Docker Compose to launch containers for Redis and the {project-title} demo app instance:
44
+
45
+
[source,console]
46
+
----
47
+
docker compose up
48
+
----
49
+
50
+
// tag::demoSteps[]
51
+
52
+
You can access the demo at http://localhost:8080/[http://localhost:8080,window=demo].
53
+
54
+
As you click around on the different pages, notice how the response time improves after the first time you request a page.
55
+
56
+
image:redis-cache-demo.png[]
57
+
58
+
Open another browser window and access the http://localhost:3000/d/1[Grafana dashboard,window=grafana].
59
+
Use username/password `admin`/`admin` to log in.
60
+
You can skip changing password.
61
+
62
+
Arrange your browser windows with the demo app on the left and Grafana on the right:
63
+
64
+
image:redis-cache-demo-grafana.png[]
65
+
66
+
Notice the HTTP response time decreasing with cache hits, and increasing with API requests.
67
+
68
+
Now click on the http://localhost:8080/movies/search[Search,window=demo] link to search the cache, for example with keyword `corleone`.
69
+
70
+
Notice how quickly search results are returned: the search feature is powered by Redis.
71
+
72
+
Search response time can be visualized with the panel at the bottom of the Grafana dashboard.
73
+
74
+
image:redis-cache-demo-search.png[]
75
+
76
+
// end::demoSteps[]
77
+
20
78
== Usage
21
79
22
80
=== Dependency
@@ -43,7 +101,7 @@ dependencies {
43
101
44
102
=== Setup
45
103
46
-
To use {name} as a backing implementation, add `RedisCacheManager` to your configuration as follows:
104
+
To use {project-title} as a backing implementation, add `RedisCacheManager` to your configuration as follows:
47
105
48
106
[source,java]
49
107
-----
@@ -53,6 +111,17 @@ public RedisCacheManager cacheManager(RedisModulesClient client) {
53
111
}
54
112
-----
55
113
114
+
Then you can tag the methods in your application that you want to apply caching to.
115
+
116
+
.Cached Method Example
117
+
[source,java]
118
+
----
119
+
@Cacheable("popular")
120
+
public List<MovieDb> fetchPopularMovies(int page) throws Exception {
121
+
return tmdbService.fetchPopularMovies(page);
122
+
}
123
+
----
124
+
56
125
`RedisCacheManager` behavior can be configured with `RedisCacheManagerBuilder`, letting you set the default `RedisCacheConfiguration` and predefined caches.
57
126
58
127
[source,java]
@@ -120,7 +189,7 @@ See the https://github.com/ben-manes/caffeine/wiki[Caffeine Documentation] for m
120
189
121
190
==== Metrics
122
191
123
-
{name} uses Micrometer to publish metrics.
192
+
{project-title} uses Micrometer to publish metrics.
124
193
To enable metrics, set a `MeterRegistry` in your `RedisCacheConfiguration`:
125
194
126
195
[source,java]
@@ -179,65 +248,11 @@ The following metrics are published:
179
248
180
249
NOTE: All metrics expose their corresponding cache name as a tag: `name=<cache>`.
181
250
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
251
== Support
237
252
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].
253
+
{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.
254
+
To report bugs, request features, or receive assistance, please {project-url}/issues[file an issue].
240
255
241
256
== License
242
257
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.
258
+
{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