dry-redis

Embedded Redis clone

License

License

Categories

Categories

Redis Data Databases
GroupId

GroupId

com.sangupta
ArtifactId

ArtifactId

dryredis
Last Version

Last Version

0.8.0
Release Date

Release Date

Type

Type

jar
Description

Description

dry-redis
Embedded Redis clone
Source Code Management

Source Code Management

https://github.com/sangupta/dry-redis

Download dryredis

How to add to project

<!-- https://jarcasting.com/artifacts/com.sangupta/dryredis/ -->
<dependency>
    <groupId>com.sangupta</groupId>
    <artifactId>dryredis</artifactId>
    <version>0.8.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.sangupta/dryredis/
implementation 'com.sangupta:dryredis:0.8.0'
// https://jarcasting.com/artifacts/com.sangupta/dryredis/
implementation ("com.sangupta:dryredis:0.8.0")
'com.sangupta:dryredis:jar:0.8.0'
<dependency org="com.sangupta" name="dryredis" rev="0.8.0">
  <artifact name="dryredis" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.sangupta', module='dryredis', version='0.8.0')
)
libraryDependencies += "com.sangupta" % "dryredis" % "0.8.0"
[com.sangupta/dryredis "0.8.0"]

Dependencies

compile (2)

Group / Artifact Type Version
com.sangupta : murmur jar 1.0.0
com.stoyanr : evictor jar 1.0.0

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Dry Redis

Build Status Coverage Status Maven Version

Pure-Java in-memory implementation to Redis that makes testing with Redis super-easy via the use of dry-run library project. The objective is to at-par with all commands that Redis supports. dry-redis can also be used to replace Redis during development phase, to be an embedded in-memory implementation so that you need not run Redis everytime.

The library is tested on the following JDK versions:

  • Oracle JDK 9
  • Oracle JDK 8
  • Oracle JDK 7
  • Open JDK 7

dry-redis was born out of frustration to test my own Redis code, as all other implementations either were too stale/old, or required me to run an embedded server connecting over TCP. Other notable implementations available include:

Table of Contents

Usage

To fetch a Redis database instance you may use one of the following methods:

DryRedis redis = DryRedis.getDatabase(); // gets the default singleton instance

// fetch a new singleton instance represented by "myDatabase"
redis = DryRedis.getDatabase("myDatabase");

// fetching an instance for "myDatabase" again will return the same instance
redis =  DryRedis.getDatabase("myDatabase"); // the instance is same as before

// All `Redis` commands are available on this instance:

redis.setnx("dryredis-version", "1"); // succeeds
redis.setnx("dryredis-version", "2"); // fails

For a list of all Redis commands, refer http://redis.io/commands.

Download

The latest released binaries are available from Maven Central using:

<dependency>
    <groupId>com.sangupta</groupId>
    <artifactId>dry-redis</artifactId>
    <version>0.8.0</version>
</dependency>

Changelog

Version 0.8.0 - 12 Apr 2017

  • 8 type of command-groups are now implemented
  • initial release

TODO

  • Thread-safety is currently not supported
  • Multiple redis databases and moving between databases is currently not supported
  • Increase unit-test code-coverage
  • Implement missing Redis commands (see below for details)
  • Remove differences from actual Redis implementations (see below for details)

Commands not yet supported:

DryRedis supports all Redis commands as of version 3.2 (stable) except the following ones:

  • Cluster
    • none of the commands is supported
  • Connection
    • none of the commands is supported
  • Geo
  • Hashes
  • HyperLogLog
  • Keys
  • Lists
    • all commands supported
  • Pub/Sub
    • none of the commands is supported
  • Scripting
    • none of the commands is supported
  • Server
    • none of the commands is supported
  • Sets
  • Sorted Set
  • Strings
  • Transactions
    • none of the commands is supported

Behaviour differences from Redis

  • Geo algorithms currently use a brute-force method, a O(n) search and thus will be slower than Redis
  • Geo methods use haversine method to compute distance between two points but return a slightly different distance than Redis
  • HyperLogLog implementation uses https://github.com/addthis/stream-lib libraries implementation and may thus slightly differ from Redis

Versioning

For transparency and insight into our release cycle, and for striving to maintain backward compatibility, dry-redis will be maintained under the Semantic Versioning guidelines as much as possible.

Releases will be numbered with the follow format:

<major>.<minor>.<patch>

And constructed with the following guidelines:

  • Breaking backward compatibility bumps the major
  • New additions without breaking backward compatibility bumps the minor
  • Bug fixes and misc changes bump the patch

For more information on SemVer, please visit http://semver.org/.

License

 dry-redis: In-memory pure java implementation to Redis
 Copyright (c) 2016-2017, Sandeep Gupta
 
 http://sangupta.com/projects/dry-redis
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

Versions

Version
0.8.0