com.udpwork.ssdb
Class SSDB

java.lang.Object
  extended by com.udpwork.ssdb.SSDB

public class SSDB
extends Object

SSDB Java client SDK. Example:

 SSDB ssdb = new SSDB("127.0.0.1", 8888);
 ssdb.set("a", "123");
 


Field Summary
 Link link
           
 
Constructor Summary
SSDB(String host, int port)
           
SSDB(String host, int port, int timeout_ms)
           
 
Method Summary
 void close()
           
 void del(byte[] key)
           
 void del(String key)
           
 byte[] get(byte[] key)
           
 byte[] get(String key)
           
 void hdel(String name, byte[] key)
           
 void hdel(String name, String key)
           
 byte[] hget(String name, byte[] key)
           
 byte[] hget(String name, String key)
           
 long hincr(String name, String key, long by)
           
 Response hrscan(String name, String key_start, String key_end, int limit)
           
 Response hscan(String name, String key_start, String key_end, int limit)
           
 void hset(String name, byte[] key, byte[] val)
           
 void hset(String name, String key, byte[] val)
           
 void hset(String name, String key, String val)
           
 long incr(String key, long by)
           
 Response multi_del(byte[]... keys)
           
 Response multi_del(String... keys)
           
 Response multi_get(byte[]... keys)
           
 Response multi_get(String... keys)
           
 void multi_set(byte[]... kvs)
           
 void multi_set(String... kvs)
           
 Response rscan(String key_start, String key_end, int limit)
           
 Response scan(String key_start, String key_end, int limit)
           
 void set(byte[] key, byte[] val)
           
 void set(String key, byte[] val)
           
 void set(String key, String val)
           
 void zdel(String name, byte[] key)
           
 void zdel(String name, String key)
           
 double zget(String name, byte[] key)
           
 double zget(String name, String key)
           
 long zincr(String name, String key, long by)
           
 Response zrscan(String name, String key, Double score_start, Double score_end, int limit)
           
 Response zscan(String name, String key, Double score_start, Double score_end, int limit)
           
 void zset(String name, byte[] key, double score)
           
 void zset(String name, String key, double score)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

link

public Link link
Constructor Detail

SSDB

public SSDB(String host,
            int port)
     throws Exception
Throws:
Exception

SSDB

public SSDB(String host,
            int port,
            int timeout_ms)
     throws Exception
Throws:
Exception
Method Detail

close

public void close()

set

public void set(byte[] key,
                byte[] val)
         throws Exception
Throws:
Exception

set

public void set(String key,
                byte[] val)
         throws Exception
Throws:
Exception

set

public void set(String key,
                String val)
         throws Exception
Throws:
Exception

del

public void del(byte[] key)
         throws Exception
Throws:
Exception

del

public void del(String key)
         throws Exception
Throws:
Exception

get

public byte[] get(byte[] key)
           throws Exception
Parameters:
key -
Returns:
null if not found
Throws:
Exception

get

public byte[] get(String key)
           throws Exception
Parameters:
key -
Returns:
null if not found
Throws:
Exception

scan

public Response scan(String key_start,
                     String key_end,
                     int limit)
              throws Exception
Throws:
Exception

rscan

public Response rscan(String key_start,
                      String key_end,
                      int limit)
               throws Exception
Throws:
Exception

incr

public long incr(String key,
                 long by)
          throws Exception
Throws:
Exception

hset

public void hset(String name,
                 byte[] key,
                 byte[] val)
          throws Exception
Throws:
Exception

hset

public void hset(String name,
                 String key,
                 byte[] val)
          throws Exception
Throws:
Exception

hset

public void hset(String name,
                 String key,
                 String val)
          throws Exception
Throws:
Exception

hdel

public void hdel(String name,
                 byte[] key)
          throws Exception
Throws:
Exception

hdel

public void hdel(String name,
                 String key)
          throws Exception
Throws:
Exception

hget

public byte[] hget(String name,
                   byte[] key)
            throws Exception
Parameters:
name -
key -
Returns:
null if not found
Throws:
Exception

hget

public byte[] hget(String name,
                   String key)
            throws Exception
Parameters:
name -
key -
Returns:
null if not found
Throws:
Exception

hscan

public Response hscan(String name,
                      String key_start,
                      String key_end,
                      int limit)
               throws Exception
Throws:
Exception

hrscan

public Response hrscan(String name,
                       String key_start,
                       String key_end,
                       int limit)
                throws Exception
Throws:
Exception

hincr

public long hincr(String name,
                  String key,
                  long by)
           throws Exception
Throws:
Exception

zset

public void zset(String name,
                 byte[] key,
                 double score)
          throws Exception
Throws:
Exception

zset

public void zset(String name,
                 String key,
                 double score)
          throws Exception
Throws:
Exception

zdel

public void zdel(String name,
                 byte[] key)
          throws Exception
Throws:
Exception

zdel

public void zdel(String name,
                 String key)
          throws Exception
Throws:
Exception

zget

public double zget(String name,
                   byte[] key)
            throws Exception
Parameters:
name -
key -
Returns:
Double.NaN if not found.
Throws:
Exception

zget

public double zget(String name,
                   String key)
            throws Exception
Parameters:
name -
key -
Returns:
Double.NaN if not found.
Throws:
Exception

zscan

public Response zscan(String name,
                      String key,
                      Double score_start,
                      Double score_end,
                      int limit)
               throws Exception
Throws:
Exception

zrscan

public Response zrscan(String name,
                       String key,
                       Double score_start,
                       Double score_end,
                       int limit)
                throws Exception
Throws:
Exception

zincr

public long zincr(String name,
                  String key,
                  long by)
           throws Exception
Throws:
Exception

multi_get

public Response multi_get(String... keys)
                   throws Exception
Throws:
Exception

multi_get

public Response multi_get(byte[]... keys)
                   throws Exception
Throws:
Exception

multi_set

public void multi_set(String... kvs)
               throws Exception
Throws:
Exception

multi_set

public void multi_set(byte[]... kvs)
               throws Exception
Throws:
Exception

multi_del

public Response multi_del(String... keys)
                   throws Exception
Throws:
Exception

multi_del

public Response multi_del(byte[]... keys)
                   throws Exception
Throws:
Exception