A Java client (wrapper) for Redis ReJSON
Java
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src modify following files May 10, 2017
.gitignore modify following files May 10, 2017
LICENSE Adds cosmetics May 9, 2017
README.md modify following files May 10, 2017
pom.xml modify following files May 10, 2017

README.md

JReJSON

A Java Client Library for ReJSON

Overview

This client provides access to ReJSON's Redis API, and provides back-and-forth serialization between Java's and its objects.

This project is currently WIP and the interface may change. Also note that only the core ReJSON commands are supported at the moment.

Installation

  1. Install Jedis (once v3 is released this step will be obsolete)
    1. Clone it: git clone --depth 1 git@github.com:xetorthio/jedis.git
    2. cd jedis
    3. mvn clean install -Dmaven.test.skip=true
  2. Install JReJSON (todo: add to maven)
    1. Clone it: git clone git@github.com:RedisLabs/JReJSON.git
    2. cd JReJSON
    3. mvn clean install -Dmaven.test.skip=true

Usage example

import redis.clients.jedis.Jedis;
import com.redislabs.modules.rejson.JReJSON;

// First get a connection
Jedis jedis = new Jedis("localhost", 6379);

// Setting a Redis key name _foo_ to the string _"bar"_, and reading it back
JReJSON.set(jedis,"foo", "bar");
String s0 = (String) JReJSON.get(jedis,"foo");

// Omitting the path (usually) defaults to the root path, so the call above to
// `get()` and the following ones // are basically interchangeable
String s1 = (String) JReJSON.get(jedis,"foo", new Path("."));
String s2 = (String) JReJSON.get(jedis, "foo", Path.RootPath());

// Any Gson-able object can be set and updated
JReJSON.set(jedis,"obj", new Object());             // just an empty object
JReJSON.set(jedis,"obj", null, new Path(".zilch"));
Path p = new Path(".whatevs");
JReJSON.set(jedis,"obj", true, p);
JReJSON.set(jedis,"obj", 42, p);
JReJSON.del(jedis,"obj", p);                        // back to almost nothing

Contributing

Please use this repository's issue tracker to submit issues and pull requests.

License

BSD 2-Clause License