forked from wg/lettuce
Scalable Java Redis client
License
huzorro/lettuce
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
lettuce - A scalable Java Redis client Lettuce is a scalable thread-safe Redis client. Multiple threads may share one RedisConnection provided they avoid blocking and transactional operations such as BLPOP, and MULTI/EXEC. Multiple connections are efficiently managed by the excellent netty NIO framework. Basic Usage RedisClient client = new RedisClient("localhost") RedisConnection<String, String> connection = client.connect() String value = connection.get("key") Each redis command is implemented by one or more methods with names identical to the lowercase redis command name. Complex commands with multiple modifiers that change the result type include the CamelCased modifier as part of the command name, e.g. zrangebyscore and zrangebyscoreWithScores. Pub/Sub RedisPubSubConnection<String, String> connection = client.connectPubSub() connection.addListener(new RedisPubSubListener<String>() { ... }) connection.subscribe("channel") Async RedisAsyncConnection<String, String> async = connection.getAsyncConnection() async.set("key", "value") async.get("key") List<Object> results = async.flush() When using an async connection all redis commands except for multi, exec, and discard will immediately return null. Calling flush() will wait for all commands to complete and then return their outputs. Async connections are just a lightweight wrapper around a regular connection and the same restrictions on blocking and transactional operations apply. The wrapper is not thread-safe and should only be used by a single thread. Codecs Lettuce supports pluggable codecs responsible for encoding and decoding keys and values. The default codec supports UTF-8 encoded String keys and values. Each connection may have its own codec passed to the extended RedisClient.connect method: RedisConnection<K, V> connect(RedisCodec<K, V> codec) Maven Artifacts Releases of lettuce are available in the maven central repository. <dependency> <groupId>com.lambdaworks</groupId> <artifactId>lettuce</artifactId> <version>1.0.0</version> </dependency>
About
Scalable Java Redis client
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published