Skip to content

Commit f4b257d

Browse files
committed
Fixed formatting
1 parent f9d0edd commit f4b257d

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

docs/develop/java/index-java.mdx

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -31,58 +31,58 @@ The blog post “[Jedis vs. Lettuce: An Exploration](https://redislabs.com/blog/
3131

3232
### Step 1. Add dependencies Jedis dependency to your Maven (or Gradle) project file:
3333

34-
```xml
34+
```xml
3535
<dependency>
3636
<groupId>redis.clients</groupId>
3737
<artifactId>jedis</artifactId>
3838
<version>3.4.0</version>
3939
</dependency>
40-
```
40+
```
4141

4242
### Step 2. Import the required classes
4343

44-
```java
44+
```java
4545
import redis.clients.jedis.*;
46-
```
46+
```
4747

4848

4949
### Step 3. Create a Connection Pool
5050

51-
Once you have added the Jedis library to your project and imported the necessary classes you can create a connection pool.
51+
Once you have added the Jedis library to your project and imported the necessary classes you can create a connection pool.
5252

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).
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).
5454

55-
```java
56-
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
57-
```
55+
```java
56+
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
57+
```
5858

5959

6060

6161
### Step 4. Write your application code
6262

63-
Once you have access to the connection pool you can now get a Jedis instance and start to interact with your Redis instance.
63+
Once you have access to the connection pool you can now get a Jedis instance and start to interact with your Redis instance.
6464

65-
```java
66-
// Create a Jedis connection pool
67-
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
65+
```java
66+
// Create a Jedis connection pool
67+
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
6868

69-
// Get the pool and use the database
70-
try (Jedis jedis = jedisPool.getResource()) {
69+
// Get the pool and use the database
70+
try (Jedis jedis = jedisPool.getResource()) {
7171

72-
jedis.set("mykey", "Hello from Jedis");
73-
String value = jedis.get("mykey");
74-
System.out.println( value );
72+
jedis.set("mykey", "Hello from Jedis");
73+
String value = jedis.get("mykey");
74+
System.out.println( value );
7575

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 );
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 );
8080

81-
}
81+
}
8282

83-
// close the connection pool
84-
jedisPool.close();
85-
```
83+
// close the connection pool
84+
jedisPool.close();
85+
```
8686

8787
Find more information about Java & Redis connections in the "[Redis Connect](https://github.com/redis-developer/redis-connect/tree/master/java/jedis)".
8888

@@ -93,42 +93,42 @@ Find more information about Java & Redis connections in the "[Redis Connect](htt
9393

9494
### Step 1. Add dependencies Jedis dependency to your Maven (or Gradle) project file:
9595

96-
```xml
96+
```xml
9797
<dependency>
98-
<groupId>io.lettuce</groupId>
99-
<artifactId>lettuce-core</artifactId>a
98+
<groupId>io.lettuce</groupId>
99+
<artifactId>lettuce-core</artifactId>a
100100
<version>6.0.1.RELEASE</version>
101101
</dependency>
102-
```
102+
```
103103

104104

105105
### Step 2. Import the Jedis classes
106106

107-
```java
107+
```java
108108
import io.lettuce.core.RedisClient;
109109
import io.lettuce.core.api.StatefulRedisConnection;
110110
import io.lettuce.core.api.sync.RedisCommands;
111-
```
111+
```
112112

113113
### Step 3. Write your application code
114114

115-
```java
116-
RedisClient redisClient = RedisClient.create("redis://localhost:6379/");
117-
StatefulRedisConnection<String, String> connection = redisClient.connect();
118-
RedisCommands<String, String> syncCommands = connection.sync();
115+
```java
116+
RedisClient redisClient = RedisClient.create("redis://localhost:6379/");
117+
StatefulRedisConnection<String, String> connection = redisClient.connect();
118+
RedisCommands<String, String> syncCommands = connection.sync();
119119

120-
syncCommands.set("mykey", "Hello from Lettuce!");
121-
String value = syncCommands.get("mykey");
122-
System.out.println( value );
123-
124-
syncCommands.zadd("vehicles", 0, "car");
125-
syncCommands.zadd("vehicles", 0, "bike");
126-
List<String> vehicles = syncCommands.zrange("vehicles", 0, -1);
127-
System.out.println( vehicles );
128-
129-
connection.close();
130-
redisClient.shutdown();
131-
```
120+
syncCommands.set("mykey", "Hello from Lettuce!");
121+
String value = syncCommands.get("mykey");
122+
System.out.println( value );
123+
124+
syncCommands.zadd("vehicles", 0, "car");
125+
syncCommands.zadd("vehicles", 0, "bike");
126+
List<String> vehicles = syncCommands.zrange("vehicles", 0, -1);
127+
System.out.println( vehicles );
128+
129+
connection.close();
130+
redisClient.shutdown();
131+
```
132132

133133

134134
Find more information about Java & Redis connections in the "[Redis Connect](https://github.com/redis-developer/redis-connect/tree/master/java/lettuce)".

0 commit comments

Comments
 (0)