Welcome to cssdbpy’s documentation! — cssdbpy 0.1 documentation (original) (raw)

What is SSDB?

SSDB is a high performance key-value(key-string, key-zset, key-hashmap) NoSQL database, an alternative to Redis. SSDB is stable, production-ready and is widely used by many Internet companies including QIHU 360. Its repository is https://github.com/ideawu/ssdb

Features

Install

or

pip install https://github.com/deslum/cssdbpy/archive/master.zip

Connection

from cssdbpy import Connection ssdb = Connection('127.0.0.1', 8888)

hset

Set the string value in argument as value of the key of a hashmap.

ssdb.execute('hset', 'test', 'hash', '1') '1'

hget

Get the value related to the specified key of a hashmap.

ssdb.execute('hget', 'test', 'hash') '1'

hdel

Delete specified key of a hashmap.

ssdb.execute('hdel', 'test', 'hash') '1'

hincr

Increment the number stored at key in a hashmap by num. The num argument could be a negative integer. The old number is first converted to an integer before increment, assuming it was stored as literal integer.

ssdb.execute('hincr', 'test', 'hash', 1) '1'

hscan

List key-value pairs of a hashmap with keys in range (key_start, key_end].

ssdb.execute('hscan', 'test', '', '', '-1') ['hash', '1']

hkeys

List keys of a hashmap in range (key_start, key_end].

ssdb.execute('hkeys', 'test', '', '', '-1') ['hash']

hsize

Return the number of key-value pairs in the hashmap.

ssdb.execute('hsize', 'test') 3

hlist

List hashmap names in range (name_start, name_end].

ssdb.execute('hlist', '', '') 3

hgetall

Returns the whole hash, as an array of strings indexed by strings.

ssdb.execute('hgetall', 'test') 3

hclear

Delete all keys in a hashmap.

ssdb.execute('hgetall', 'test') 3

multi_hset

Set multiple key-value pairs(kvs) of a hashmap in one method call.

ssdb.execute('hgetall', 'test') 3

multi_hget

Get the values related to the specified multiple keys of a hashmap.

ssdb.execute('hgetall', 'test') 3

multi_hdel

Delete specified multiple keys in a hashmap.

ssdb.execute('hgetall', 'test') 3