Skip to content

zhonghao-cliqz/ssdb.py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssdb.py

Ssdb Python Client Library (threading local), SSDB is a fast nosql database, an alternative to redis (https://github.com/ideawu/ssdb).

Latest version: v0.1.6

  • Support Python 2.6+ or Python 3.3+
  • Support ssdb version: SSDB 1.6.8.8+
  • UTF-8 encoding for all conversions between bytes and unicodes.

Changes for 0.1.6:

  • Faster protocol parser via spp_py built on C extension.
  • No more fix types for zset scores, now is str. (Non-Backward Compact)
  • Add api client.close

Ports

Installation

$ pip install ssdb.py

API Reference (Redis-py like)

Sample Usage

>>> import ssdb
>>> c = ssdb.Client()
>>> c.set('key', 'val')
1
>>> c.get('key')
'val'

Pipeline

>>> with c.pipeline() as pipe:
...   pipe.set('k1', 'v1')
...   pipe.set('k2', 'v2')
...   pipe.multi_get('k1', 'k2')
...   pipe.execute()
...
[1, 1, ['k1', 'v1', 'k2', 'v2']]

Returns

  1. If response status is "ok", return the data.
  2. If response status is "not_found", return None.
  3. If response status is "client_error" or other(errors), raise SSDBException.

Built-in Exceptions

class SSDBException(Exception):
    pass

Types

The data type each command returns can be found in ssdb.py commands.

Documentation

Detail docs for this module can be found at https://github.com/hit9/ssdb.api.docs

License

LICENSE-BSD2

About

Fast ssdb client Library for Python 2, 3

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%