Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrall committed Dec 31, 2020
0 parents commit 57f3e1f
Show file tree
Hide file tree
Showing 29 changed files with 15,336 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Website

This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.

## Installation

```console
yarn install
```

## Local Development

```console
yarn start
```

This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server.

## Build

```console
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

```console
GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy
```

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.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
11 changes: 11 additions & 0 deletions blog/2019-05-28-hola.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
slug: hola
title: Hola
author: Gao Wei
author_title: Docusaurus Core Team
author_url: https://github.com/wgao19
author_image_url: https://avatars1.githubusercontent.com/u/2055384?v=4
tags: [hola, docusaurus]
---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
17 changes: 17 additions & 0 deletions blog/2019-05-29-hello-world.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
slug: hello-world
title: Hello
author: Endilie Yacop Sucipto
author_title: Maintainer of Docusaurus
author_url: https://github.com/endiliey
author_image_url: https://avatars1.githubusercontent.com/u/17883920?s=460&v=4
tags: [hello, docusaurus]
---

Welcome to this blog. This blog is created with [**Docusaurus 2 alpha**](https://v2.docusaurus.io/).

<!--truncate-->

This is a test post.

A whole bunch of other information.
13 changes: 13 additions & 0 deletions blog/2019-05-30-welcome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
slug: welcome
title: Welcome
author: Yangshun Tay
author_title: Front End Engineer @ Facebook
author_url: https://github.com/yangshun
author_image_url: https://avatars0.githubusercontent.com/u/1315101?s=400&v=4
tags: [facebook, hello, docusaurus]
---

Blog features are powered by the blog plugin. Simply add files to the `blog` directory. It supports tags as well!

Delete the whole directory if you don't want the blog features. As simple as that!
1 change: 1 addition & 0 deletions docs/develop/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TEst
235 changes: 235 additions & 0 deletions docs/develop/java/index-java.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
---
id: index-java
title: Java and Redis
sidebar_label: Java
slug: /develop/java/
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import useBaseUrl from '@docusaurus/useBaseUrl';

Find Tutorials, Examples and Technical articles that will help you to develop with Redis and Java.


## Getting Started

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

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.


<Tabs
defaultValue="jedis"
values={[
{label: 'Jedis', value: 'jedis'},
{label: 'Lettuce', value: 'lettuce'},
]}>
<TabItem value="jedis">

### Getting Started with Jedis


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

```xml
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>3.4.0</version>
</dependency>
```

2. Import the required classes

```java
import redis.clients.jedis.*;
```


3. Create a Connection Pool

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

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

```java
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);
```



4. Write your application code

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

```java
// Create a Jedis connection pool
JedisPool jedisPool = new JedisPool(new JedisPoolConfig(), "localhost", 6379);

// Get the pool and use the database
try (Jedis jedis = jedisPool.getResource()) {

jedis.set("mykey", "Hello from Jedis");
String value = jedis.get("mykey");
System.out.println( value );

jedis.zadd("vehicles", 0, "car");
jedis.zadd("vehicles", 0, "bike");
Set<String> vehicles = jedis.zrange("vehicles", 0, -1);
System.out.println( vehicles );

}

// close the connection pool
jedisPool.close();
```



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


</TabItem>
<TabItem value="lettuce">

### Getting Started with Lettuce

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

```xml
<dependency>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>a
<version>6.0.1.RELEASE</version>
</dependency>
```


2. Import the Jedis classes

```java
import io.lettuce.core.RedisClient;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
```

3. Write your application code

```java
RedisClient redisClient = RedisClient.create("redis://localhost:6379/");
StatefulRedisConnection<String, String> connection = redisClient.connect();
RedisCommands<String, String> syncCommands = connection.sync();

syncCommands.set("mykey", "Hello from Lettuce!");
String value = syncCommands.get("mykey");
System.out.println( value );

syncCommands.zadd("vehicles", 0, "car");
syncCommands.zadd("vehicles", 0, "bike");
List<String> vehicles = syncCommands.zrange("vehicles", 0, -1);
System.out.println( vehicles );

connection.close();
redisClient.shutdown();
```


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

----

## Ecosystem

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



<div class="row text--center">

<div class="col ">

#### Develop with Spring

![Spring logo](/img/logos/spring.png)

[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.

</div>

<div class="col">

#### Develop with Vert.x

![Vert.x logo](/img/logos/vertx.png)

[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.
</div>

<div class="col">

#### Develop with Micronaut

![Micronaut logo](/img/logos/micronaut.svg)

[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.

</div>

</div>

---

## More developer resources

<div class="row">

<div class="col">

#### Sample Code

**[Brewdis - Product Catalog (Spring)](https://github.com/redis-developer/brewdis)**
See how to use Redis and Spring to build a product catalog with streams, hashes and RediSearch


**[Redis Stream in Action (Spring)](https://github.com/redis-developer/brewdis)**
See how to use Spring to create multiple producer and consumers with Redis Streams


**[Rate Limiting with Vert.x](https://github.com/redis-developer/vertx-rate-limiting-redis)**
See how to use Redis Sorted Set with Vert.x to build a rate limiting service.


**[Redis Java Samples with Lettuce](https://github.com/redis-developer/vertx-rate-limiting-redis)**
Run Redis Commands from Lettuce


</div>
<div class="col col--1">
</div>

<div class="col">

#### Technical Articles

**[Getting Started with Redis Streams and Java (Lettuce)](https://redislabs.com/blog/getting-started-with-redis-streams-and-java/)**

**[Jedis vs. Lettuce: An Exploration](https://redislabs.com/blog/jedis-vs-lettuce-an-exploration/https://redislabs.com/blog/jedis-vs-lettuce-an-exploration/)**


</div>

</div>

---

## Redis University

### [Redis for Java Developers](https://university.redislabs.com/courses/ru102j/)

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.

<div class="text--center">
<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>
</div>
Loading

0 comments on commit 57f3e1f

Please sign in to comment.