- Spring Data Tutorial - Home
- Spring Data Apache Solr
- Overview
- Prerequisites
- Introduction
- What is Apache Solr?
- Getting Started
- Querying
- Features
- Conclusion
- Spring Data Cassandra
- Overview
- Prerequisites
- Introduction
- What is Cassandra?
- Getting Started
- Annotation AllowFiltering with Query Methods
- Partition and Clustering
- Coding hands-on on Partitioning and Clustering
- Features
- Conclusion
- Spring Data Couchbase
- Overview
- Prerequisites
- Introduction
- What is Couchbase?
- Getting Started
- Views
- CouchbaseTemplate
- Hands-on using CouchbaseTemplate
- Features
- Conclusion
- Spring Data Elasticsearch
- Overview
- Prerequisites
- Introduction
- What is ElasticSearch?
- Getting Started
- Querying
- Configuring ElasticsearchOperations bean
- Features
- Conclusion
- Spring Data JDBC
- Introduction
- Need of Spring Data JDBC
- Features
- Domain-Driven Design
- Prerequisites
- Getting Started
- Conclusion
- Spring Data JPA
- Background
- Introduction
- Prerequisites
- Getting Started
- Features
- Conclusion
- Spring Data MongoDB
- Overview
- Prerequisites
- Introduction
- What is MongoDB?
- Getting Started
- Query Methods
- Annotations
- Exposing REST end points
- Relationship
- Conclusion
- Spring Data Redis
- Overview
- Prerequisites
- Introduction
- What is Redis?
- Redis Java Clients
- Getting Started
- Features
- Conclusion
- Spring Data REST
- Background
- Introduction to Spring Data REST
- Prerequisites
- Getting Started
- Features
- Conclusion
- Spring Data Tutorial Useful Resources
- Spring Data Tutorial - Quick Guide
- Spring Data Tutorial - Useful Resources
- Spring Data Tutorial - Discussion
Redis Java Clients
As we know that, to connect with the relational database we need Driver, Similarly, we need a client to connect to a Redis database. A client allows us to communicate with the database programmatically. There are many Redis client that supports most of the programming languages. In this tutorial we will work with the most popular Java Client Jedis. Though there are Java clients as well such as Lettuce RJC, and Radisson, etc. To know more about Java Clients that Redis support click here
What is Jedis
Jedis is a java client library. It is a small lightweight and extremely fast client library in Java for Redis. Spring Data supports Jedis because the implementation of Redis using Jedis is painless. One thing to remember is that Jedis instance is not thread-safe, However using Jedis pool we can achieve thread-safety. Just make a note, Redis itself is a single−threaded which provides concurrency.
Jedis Pool
Jedis pool objects are thread−safe, and can be used for multiple threads. Instead of creating a new connection to the database each time when we send a database request we prefer using the pool. Pool keeps several connections open based on the pool configuration and when a request comes in, it takes a connection from the pool and returns it to the pool when the request is fulfilled. Doing so improves the performance by avoiding the creation of a new connection with each new request.