Skip to content

Commit 57f3e1f

Browse files
committed
first commit
0 parents  commit 57f3e1f

29 files changed

+15336
-0
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
4+
5+
## Installation
6+
7+
```console
8+
yarn install
9+
```
10+
11+
## Local Development
12+
13+
```console
14+
yarn start
15+
```
16+
17+
This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
## Build
20+
21+
```console
22+
yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
## Deployment
28+
29+
```console
30+
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
31+
```
32+
33+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

blog/2019-05-28-hola.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
slug: hola
3+
title: Hola
4+
author: Gao Wei
5+
author_title: Docusaurus Core Team
6+
author_url: https://github.com/wgao19
7+
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
8+
tags: [hola, docusaurus]
9+
---
10+
11+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

blog/2019-05-29-hello-world.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
slug: hello-world
3+
title: Hello
4+
author: Endilie Yacop Sucipto
5+
author_title: Maintainer of Docusaurus
6+
author_url: https://github.com/endiliey
7+
author_image_url: https://avatars1.githubusercontent.com/u/17883920?s=460&v=4
8+
tags: [hello, docusaurus]
9+
---
10+
11+
Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/).
12+
13+
<!--truncate-->
14+
15+
This is a test post.
16+
17+
A whole bunch of other information.

blog/2019-05-30-welcome.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
slug: welcome
3+
title: Welcome
4+
author: Yangshun Tay
5+
author_title: Front End Engineer @ Facebook
6+
author_url: https://github.com/yangshun
7+
author_image_url: https://avatars0.githubusercontent.com/u/1315101?s=400&v=4
8+
tags: [facebook, hello, docusaurus]
9+
---
10+
11+
Blog features are powered by the blog plugin. Simply add files to the `blog` directory. It supports tags as well!
12+
13+
Delete the whole directory if you don't want the blog features. As simple as that!

docs/develop/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# TEst

docs/develop/java/index-java.mdx

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
---
2+
id: index-java
3+
title: Java and Redis
4+
sidebar_label: Java
5+
slug: /develop/java/
6+
---
7+
import Tabs from '@theme/Tabs';
8+
import TabItem from '@theme/TabItem';
9+
import useBaseUrl from '@docusaurus/useBaseUrl';
10+
11+
Find Tutorials, Examples and Technical articles that will help you to develop with Redis and Java.
12+
13+
14+
## Getting Started
15+
16+
Java community has built many client libraries that you can find [here](https://redis.io/clients#java). For your first steps with Java and Redis, this article will show how to use the two main libraries: [Jedis](https://github.com/redis/jedis) and [Lettuce](https://lettuce.io/).
17+
18+
The blog post “[Jedis vs. Lettuce: An Exploration](https://redislabs.com/blog/jedis-vs-lettuce-an-exploration/)” will help you to select the best for your application; keeping in mind that both are available in Spring & SpringBoot framework.
19+
20+
21+
<Tabs
22+
defaultValue="jedis"
23+
values={[
24+
{label: 'Jedis', value: 'jedis'},
25+
{label: 'Lettuce', value: 'lettuce'},
26+
]}>
27+
<TabItem value="jedis">
28+
29+
### Getting Started with Jedis
30+
31+
32+
1. Add dependencies Jedis dependency to your Maven (or Gradle) project file:
33+
34+
```xml
35+
<dependency>
36+
<groupId>redis.clients</groupId>
37+
<artifactId>jedis</artifactId>
38+
<version>3.4.0</version>
39+
</dependency>
40+
```
41+
42+
2. Import the required classes
43+
44+
```java
45+
import redis.clients.jedis.*;
46+
```
47+
48+
49+
3. Create a Connection Pool
50+
51+
Once you have added the Jedis library to your project and imported the necessary classes you can create a connection pool.
52+
53+
You can find more information about Jedis connection pool in the [Jedis Wiki](https://github.com/redis/jedis/wiki/Getting-started#basic-usage-example). The connection pool is based on the [Apache Common Pool 2.0 library](http://commons.apache.org/proper/commons-pool/apidocs/org/apache/commons/pool2/impl/GenericObjectPoolConfig.html).
54+
55+
```java
56+
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
57+
```
58+
59+
60+
61+
4. Write your application code
62+
63+
Once you have access to the connection pool you can now get a Jedis instance and start to interact with your Redis instance.
64+
65+
```java
66+
// Create a Jedis connection pool
67+
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
68+
69+
// Get the pool and use the database
70+
try (Jedis jedis = jedisPool.getResource()) {
71+
72+
jedis.set("mykey", "Hello from Jedis");
73+
String value = jedis.get("mykey");
74+
System.out.println( value );
75+
76+
jedis.zadd("vehicles", 0, "car");
77+
jedis.zadd("vehicles", 0, "bike");
78+
Set<String> vehicles = jedis.zrange("vehicles", 0, -1);
79+
System.out.println( vehicles );
80+
81+
}
82+
83+
// close the connection pool
84+
jedisPool.close();
85+
```
86+
87+
88+
89+
Find more information about Java & Redis connections in the "[Redis Connect](https://github.com/redis-developer/redis-connect/tree/master/java/jedis)".
90+
91+
92+
</TabItem>
93+
<TabItem value="lettuce">
94+
95+
### Getting Started with Lettuce
96+
97+
1. Add dependencies Jedis dependency to your Maven (or Gradle) project file:
98+
99+
```xml
100+
<dependency>
101+
<groupId>io.lettuce</groupId>
102+
<artifactId>lettuce-core</artifactId>a
103+
<version>6.0.1.RELEASE</version>
104+
</dependency>
105+
```
106+
107+
108+
2. Import the Jedis classes
109+
110+
```java
111+
import io.lettuce.core.RedisClient;
112+
import io.lettuce.core.api.StatefulRedisConnection;
113+
import io.lettuce.core.api.sync.RedisCommands;
114+
```
115+
116+
3. Write your application code
117+
118+
```java
119+
RedisClient redisClient = RedisClient.create("redis://localhost:6379/");
120+
StatefulRedisConnection<String, String> connection = redisClient.connect();
121+
RedisCommands<String, String> syncCommands = connection.sync();
122+
123+
syncCommands.set("mykey", "Hello from Lettuce!");
124+
String value = syncCommands.get("mykey");
125+
System.out.println( value );
126+
127+
syncCommands.zadd("vehicles", 0, "car");
128+
syncCommands.zadd("vehicles", 0, "bike");
129+
List<String> vehicles = syncCommands.zrange("vehicles", 0, -1);
130+
System.out.println( vehicles );
131+
132+
connection.close();
133+
redisClient.shutdown();
134+
```
135+
136+
137+
Find more information about Java & Redis connections in the "[Redis Connect](https://github.com/redis-developer/redis-connect/tree/master/java/lettuce)".
138+
</TabItem>
139+
</Tabs>
140+
141+
----
142+
143+
## Ecosystem
144+
145+
As developer you can use the Java client library directly in your application, or you can frameworks like: [Spring](https://spring.io/), [Vert.x](https://vertx.io/), and [Micronaut](https://micronaut.io/).
146+
147+
148+
149+
<div class="row text--center">
150+
151+
<div class="col ">
152+
153+
#### Develop with Spring
154+
155+
![Spring logo](/img/logos/spring.png)
156+
157+
[Spring Data Redis](https://spring.io/projects/spring-data-redis), part of the larger Spring Data project. It provides easy access to Redis from Spring applications.
158+
159+
</div>
160+
161+
<div class="col">
162+
163+
#### Develop with Vert.x
164+
165+
![Vert.x logo](/img/logos/vertx.png)
166+
167+
[Eclipse Vert.x](https://vertx.io/introduction-to-vertx-and-reactive/) is a framework to build reactive applications on the JVM. [Vert.x-redis](https://vertx.io/docs/vertx-redis-client/java/) is redis client to be used with Vert.x.
168+
</div>
169+
170+
<div class="col">
171+
172+
#### Develop with Micronaut
173+
174+
![Micronaut logo](/img/logos/micronaut.svg)
175+
176+
[Micronaut](https://micronaut.io/) is a framework for building microservices and serverless applications. The [Micronaut Redis](https://micronaut-projects.github.io/micronaut-redis/snapshot/guide/) extension provides the integration with Redis.
177+
178+
</div>
179+
180+
</div>
181+
182+
---
183+
184+
## More developer resources
185+
186+
<div class="row">
187+
188+
<div class="col">
189+
190+
#### Sample Code
191+
192+
**[Brewdis - Product Catalog (Spring)](https://github.com/redis-developer/brewdis)**
193+
See how to use Redis and Spring to build a product catalog with streams, hashes and RediSearch
194+
195+
196+
**[Redis Stream in Action (Spring)](https://github.com/redis-developer/brewdis)**
197+
See how to use Spring to create multiple producer and consumers with Redis Streams
198+
199+
200+
**[Rate Limiting with Vert.x](https://github.com/redis-developer/vertx-rate-limiting-redis)**
201+
See how to use Redis Sorted Set with Vert.x to build a rate limiting service.
202+
203+
204+
**[Redis Java Samples with Lettuce](https://github.com/redis-developer/vertx-rate-limiting-redis)**
205+
Run Redis Commands from Lettuce
206+
207+
208+
</div>
209+
<div class="col col--1">
210+
</div>
211+
212+
<div class="col">
213+
214+
#### Technical Articles
215+
216+
**[Getting Started with Redis Streams and Java (Lettuce)](https://redislabs.com/blog/getting-started-with-redis-streams-and-java/)**
217+
218+
**[Jedis vs. Lettuce: An Exploration](https://redislabs.com/blog/jedis-vs-lettuce-an-exploration/https://redislabs.com/blog/jedis-vs-lettuce-an-exploration/)**
219+
220+
221+
</div>
222+
223+
</div>
224+
225+
---
226+
227+
## Redis University
228+
229+
### [Redis for Java Developers](https://university.redislabs.com/courses/ru102j/)
230+
231+
Redis for Java Developers teaches you how to build robust Redis client applications in Java using the Jedis client library. The course focuses on writing idiomatic Java applications with the Jedis API, describing language-specific patterns for managing Redis database connections, handling errors, and using standard classes from the JDK. The course material uses the Jedis API directly with no additional frameworks. As such, the course is appropriate for all Java developers, and it clearly illustrates the principles involved in writing applications with Redis.
232+
233+
<div class="text--center">
234+
<iframe width="560" height="315" src="https://www.youtube.com/embed/CmQMdJefTjc" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
235+
</div>

0 commit comments

Comments
 (0)