Giter VIP home page Giter VIP logo

redisson's Introduction

##Redisson - distributed and scalable Java data structures on top of Redis server. Advanced Redis client

Use familiar Java data structures with power of Redis.

Based on patched version of lettuce Redis client and Netty 4 framework.
Redis 2.4+ and JDK 1.6+ compatible

Licensed under the Apache License 2.0.

Features

  • Distributed implementation of java.util.List
  • Distributed implementation of java.util.Set
  • Distributed implementation of java.util.SortedSet
  • Distributed implementation of java.util.Queue
  • Distributed implementation of java.util.Map
  • Distributed implementation of java.util.concurrent.ConcurrentMap
  • Distributed implementation of reentrant java.util.concurrent.locks.Lock
  • Distributed alternative to the java.util.concurrent.atomic.AtomicLong
  • Distributed alternative to the java.util.concurrent.CountDownLatch
  • Distributed publish/subscribe messaging via org.redisson.core.RTopic object
  • Thread-safe implementation
  • Supports OSGi
  • With over 90 unit tests

Recent Releases

####Please Note: trunk is current development branch.

####26-Mar-2014 - version 1.0.3 released Fixed - RedissonAtomicLong state format
Fixed - Long serialization in JsonJacksonCodec

####05-Feb-2014 - version 1.0.2 released Feature - distributed implementation of java.util.SortedSet
Fixed - OSGi compability

####17-Jan-2014 - version 1.0.1 released Improvement - forceUnlock, isLocked, isHeldByCurrentThread and getHoldCount methods added to RLock
Feature - connection load balancer to use multiple Redis servers
Feature - published in maven central repo

####11-Jan-2014 - version 1.0.0 released First stable release.

Maven

Include the following to your dependency list:

<dependency>
   <groupId>org.redisson</groupId>
   <artifactId>redisson</artifactId>
   <version>1.0.2</version>
</dependency>

Usage examples

####Simple config example

    // connects to Redis server 127.0.0.1:6379 by default
    Redisson redisson = Redisson.create();

    ...

    redisson.shutdown();

or with initialization by Config object

    Config config = new Config();
    config.setConnectionPoolSize(10);

    // Redisson will use load balance connections between listed servers
    config.addAddress("first.redisserver.com:8291");
    config.addAddress("second.redisserver.com:8291");
    config.addAddress("third.redisserver.com:8291");

    Redisson redisson = Redisson.create(config);

    ...

    redisson.shutdown();

####Distributed Map example

    Redisson redisson = Redisson.create();

    ConcurrentMap<String, SomeObject> map = redisson.getMap("anyMap");
    map.put("123", new SomeObject());
    map.putIfAbsent("323", new SomeObject());
    map.remove("123");

    ...

    redisson.shutdown();

####Distributed Set example

    Redisson redisson = Redisson.create();

    Set<SomeObject> set = redisson.getSet("anySet");
    set.add(new SomeObject());
    set.remove(new SomeObject());

    ...

    redisson.shutdown();

####Distributed List example

    Redisson redisson = Redisson.create();

    List<SomeObject> list = redisson.getList("anyList");
    list.add(new SomeObject());
    list.get(0);
    list.remove(new SomeObject());

    ...

    redisson.shutdown();

####Distributed Queue example

    Redisson redisson = Redisson.create();

    Queue<SomeObject> queue = redisson.getQueue("anyQueue");
    queue.add(new SomeObject());
    queue.peek();
    queue.pool();

    ...

    redisson.shutdown();

####Distributed Lock example

    Redisson redisson = Redisson.create();

    Lock lock = redisson.getLock("anyLock");
    lock.lock();
    lock.unlock();

    // same as

    redisson.getLock("anyLock").lock();

    ...

    redisson.getLock("anyLock").unlock();

    ...

    redisson.shutdown();

####Distributed AtomicLong example

    Redisson redisson = Redisson.create();

    RAtomicLong atomicLong = redisson.getAtomicLong("anyAtomicLong");
    atomicLong.set(3);
    atomicLong.incrementAndGet();
    atomicLong.get();

    ...

    redisson.shutdown();

####Distributed CountDownLatch example

    Redisson redisson = Redisson.create();

    RCountDownLatch latch = redisson.getCountDownLatch("anyCountDownLatch");
    latch.trySetCount(1);
    latch.await();

    // in other thread or other JVM

    RCountDownLatch latch = redisson.getCountDownLatch("anyCountDownLatch");
    latch.countDown();

    ...

    redisson.shutdown();

####Distributed Topic example

    Redisson redisson = Redisson.create();

    RTopic<SomeObject> topic = redisson.getTopic("anyTopic");
    topic.addListener(new MessageListener<SomeObject>() {

         public void onMessage(SomeObject message) {
            ...
         }
    });

    // in other thread or other JVM

    RTopic<SomeObject> topic = redisson.getTopic("anyTopic");
    topic.publish(new SomeObject());


    ...

    redisson.shutdown();

redisson's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.