Skip to content

Commit 53bea12

Browse files
committed
docs: Added TOC
1 parent 7a7e32e commit 53bea12

File tree

1 file changed

+89
-70
lines changed

1 file changed

+89
-70
lines changed

README.adoc

+89-70
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,84 @@
11
= Redis Cache Java
2+
:toc:
3+
:toc-placement!:
24
:linkattrs:
3-
:project-owner: redis-field-engineering
4-
:project-name: redis-cache
5-
:dist-repo: redis-cache-java-dist
6-
:name: Redis Cache Java
7-
:project-group: com.redis
8-
:project-version: 0.1.2
9-
:project-url: https://github.com/{project-owner}/{dist-repo}
10-
:codecov-token: 2cAc3dgZRA
11-
:artifact-id: redis-cache-core
12-
:imagesdir: .github/media
5+
:imagesdir: .github/media
6+
:codecov-token: 2cAc3dgZRA
7+
:artifact-id: redis-cache-core
8+
:project-dist: redis-cache-java-dist
9+
:project-group: com.redis
10+
:project-name: redis-cache-java
11+
:project-owner: redis-field-engineering
12+
:project-title: Redis Cache Java
13+
:project-url: https://github.com/{project-owner}/{project-dist}
14+
:project-version: 0.2.0
1315

1416
image:https://github.com/{project-owner}/{project-name}/actions/workflows/early-access.yml/badge.svg["Build Status", link="https://github.com/{project-owner}/{project-name}/actions/workflows/early-access.yml"]
1517
image:https://codecov.io/gh/{project-owner}/{project-name}/graph/badge.svg?token={codecov-token}["Coverage", link="https://codecov.io/gh/{project-owner}/{project-name}"]
1618

17-
{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.
1820
It provides an implementation of Spring Framework's https://docs.spring.io/spring-framework/reference/6.1/integration.html#cache[Cache Abstraction].
1921

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+
2082
== Usage
2183

2284
=== Dependency
@@ -43,7 +105,7 @@ dependencies {
43105

44106
=== Setup
45107

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:
47109

48110
[source,java]
49111
-----
@@ -53,6 +115,17 @@ public RedisCacheManager cacheManager(RedisModulesClient client) {
53115
}
54116
-----
55117

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+
56129
`RedisCacheManager` behavior can be configured with `RedisCacheManagerBuilder`, letting you set the default `RedisCacheConfiguration` and predefined caches.
57130

58131
[source,java]
@@ -120,7 +193,7 @@ See the https://github.com/ben-manes/caffeine/wiki[Caffeine Documentation] for m
120193

121194
==== Metrics
122195

123-
{name} uses Micrometer to publish metrics.
196+
{project-title} uses Micrometer to publish metrics.
124197
To enable metrics, set a `MeterRegistry` in your `RedisCacheConfiguration`:
125198

126199
[source,java]
@@ -179,65 +252,11 @@ The following metrics are published:
179252

180253
NOTE: All metrics expose their corresponding cache name as a tag: `name=<cache>`.
181254

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-
236255
== Support
237256

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].
240259

241260
== License
242261

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

Comments
 (0)