Available Clients

Redis

Pulsar is shipped with a Store implementation for redis and pulsard-ds servers.

Redis Store

class pulsar.apps.data.redis.store.RedisStore(name, host, loop=None, protocol_factory=None, **kw)[source]

Redis Store implementation.

client()[source]

Get a RedisClient for the Store

close()[source]

Close all open connections.

meta(meta)[source]

Extract model metadata for lua script stdnet/lib/lua/odm.lua

namespace

The prefix namespace to append to all transaction on keys

pipeline()[source]

Get a Pipeline for the Store

Redis Client

class pulsar.apps.data.redis.client.RedisClient(store)[source]

Client for RedisStore.

store

The RedisStore for this client.

pipeline()[source]

Create a Pipeline for pipelining commands

set(name, value, ex=None, px=None, nx=False, xx=False)[source]

Set the value at key name to value

Parameters:
  • ex – sets an expire flag on key name for ex seconds.
  • px – sets an expire flag on key name for px milliseconds.
  • nx – if set to True, set the value at key name to value if it does not already exist.
  • xx – if set to True, set the value at key name to value if it already exists.
zadd(name, *args, **kwargs)[source]

Set any number of score, element-name pairs to the key name. Pairs can be specified in two ways:

As *args, in the form of:

score1, name1, score2, name2, ...

or as **kwargs, in the form of:

name1=score1, name2=score2, ...

The following example would add four values to the ‘my-key’ key:

client.zadd('my-key', 1.1, 'name1', 2.2, 'name2',
            name3=3.3, name4=4.4)
sort(key, start=None, num=None, by=None, get=None, desc=False, alpha=False, store=None, groups=False)[source]

Sort and return the list, set or sorted set at key.

start and num allow for paging through the sorted data

by allows using an external key to weight and sort the items.
Use an “*” to indicate where in the key the item value is located
get allows for returning items from external keys rather than the
sorted data itself. Use an “*” to indicate where int he key the item value is located

desc allows for reversing the sort

alpha allows for sorting lexicographically rather than numerically

store allows for storing the result of the sort into
the key store
groups if set to True and if get contains at least two
elements, sort will return a list of tuples, each containing the values fetched from the arguments to get.

Redis Pipeline

class pulsar.apps.data.redis.client.Pipeline(store)[source]

A RedisClient for pipelining commands

commit(raise_on_error=True)[source]

Send commands to redis.

PulsarDs

It has the same implementation as redis client.