Skip to content

Latest commit

 

History

History
62 lines (50 loc) · 1.38 KB

README.md

File metadata and controls

62 lines (50 loc) · 1.38 KB

rlite-py

Build Status PyPI version

Python bindings for rlite. For more information about rlite, go to rlite repository

Installation

$ pip install hirlite

Usage

>>> import hirlite
>>> rlite = hirlite.Rlite()
>>> rlite.command('set', 'key', 'value')
True
>>> rlite.command('get', 'key')
'value'

Unicode

>>> rlite = hirlite.Rlite(encoding='utf8')
>>> rlite.command('set', 'key', 'value')
True
>>> rlite.command('get', 'key')
u'value'

Persistence

>>> rlite = hirlite.Rlite(path='mydb.rld')
>>> rlite.command('set', 'key', 'value')
True
>>> rlite = hirlite.Rlite(path='mydb.rld')
>>> rlite.command('get', 'key')
'value'

Pubsub

>>> subscriber = hirlite.Rlite(path='mydb.rld')
>>> subscriber.command('subscribe', 'channel', 'channel2')
['subscribe', 'channel', 1L]
>>> subscriber.command('__rlite_poll')
['subscribe', 'channel2', 2L]
>>> subscriber.command('__rlite_poll')
>>> publisher = hirlite.Rlite(path='mydb.rld')
>>> publisher.command('publish', 'channel', 'hello world')
1L
>>> subscriber.command('__rlite_poll')
['message', 'channel', 'hello world']
>>> subscriber.command('__rlite_poll')
>>>