sider.session — Sessions

What sessions mainly do are identity map and unit of work.

class sider.session.Session(client)

Session is an object which manages Python objects that represent Redis values e.g. lists, sets, hashes. It maintains identity maps between Redis values and Python objects, and deals with transactions.

Parameters:client (redis.client.Client) – the Redis client
get(key, value_type=<class 'sider.types.ByteString'>)

Loads the value from the key. If value_type is present the value will be treated as it, or ByteString by default.

Parameters:
  • key (str) – the Redis key to load
  • value_type (Value, type) – the type of the value to load. default is ByteString
Returns:

the loaded value

server_version

(str) Redis server version string e.g. '2.2.11'.

server_version_info

(tuple) Redis server version triple e.g. (2, 2, 11). You can compare versions using this property.

set(key, value, value_type=<class 'sider.types.ByteString'>)

Stores the value into the key. If value_type is present the value will be treated as it, or ByteString by default.

Parameters:
  • key (str) – the Redis key to save the value into
  • value – the value to be saved
  • value_type (Value, type) – the type of the value. default is ByteString
Returns:

the Python representation of the saved value. it is equivalent to the given value but may not equal nor the same to

Project Versions

Previous topic

sider — Sider

Next topic

sider.types — Conversion between Python and Redis types

This Page