Code Monkey home page Code Monkey logo

tedis's Introduction

Tedis

 _____              _   _
|_   _|   ___    __| | (_)  ___
  | |    / _ \  / _` | | | / __|
  | |   |  __/ | (_| | | | \__ \
  |_|    \___|  \__,_| |_| |___/

Tedis is a redis client based on tcp & resp.

Features:

  • synchronous API
  • asynchronous API
  • connection pool
  • single node distributed lock
  • bloom-filter
  • validate conn activation & auto-retry
  • check issue permission(in annotation) using dynamic proxy
  • pipeline
  • subscribe/publish
  • Lua script
  • SSL
  • Redis Cluster

How to use

  • Request/Response mode
public void pingTest() {
    Tedis tedis = TedisClient.tedis();
    tedis.ping();
    tedis.ping("HELLO");
    tedis.close();
}
  • Pipeline
public void pipelineTest() {
    Tedis tedis = TedisClient.tedis();
    tedis.setMode(TedisClient.PIPELINE);
    tedis.get("a");
    tedis.set("a", "1");
    tedis.get("a");
    Results r = tedis.submit().sync(); // nil, OK, 1
    tedis.close();
}
  • SUB/PUB
public void subpubTest() {
    Tedis tedis = TedisClient.tedis();
    tedis.subscribe("news");
    tedis.unsubscribe("news");
    tedis.psubscribe("n*");
    tedis.punsubscribe("n*");
    tedis.publish("news", "foobar");
    tedis.close();
}
  • Lock
public lockTest() {
    Tedis tedis = TedisClient.tedis();
    TedisLock lock = tedis.newLock();
    try {
       lock.lock();
       //...
    } finally {
        lock.unlock();
    }
    tedis.close();
}
  • BloomFiter
public bloomFilterTest() {
    Tedis tedis = TedisClient.tedis();
    // int a: insertions
    // double b: falseProbability
    BloomFilter bf = tedis.newBloomFilter(a, b);
    bf.add("str");
    assertTrue(bf.include("str"));
    tedis.close()
}
  • More in Test Class

Structure

tedis's People

Contributors

dependabot[bot] avatar ngtrio avatar

Stargazers

 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.