tcex.tcex_redis module

TcEx Framework Redis Module

class tcex.tcex_redis.TcExRedis(host, port, rhash)[source]

Bases: object

Create/Read Data in/from Redis

blpop(keys, timeout=30)[source]

RPOP a value off the first empty list in keys.

Note

If timeout is 0, the block indefinitely.

Parameters:
  • keys (string|list) – The key(s) to pop the value.
  • timeout (int) – The number of seconds to wait before blocking stops.
Returns:

The response from Redis.

Return type:

(string)

create(key, value)[source]

Create key/value pair in Redis.

Parameters:
  • key (string) – The key to create in Redis.
  • value (any) – The value to store in Redis.
Returns:

The response from Redis.

Return type:

(string)

delete(key)[source]

Alias for hdel method.

hdel(key)[source]

Delete data from Redis for the provided key.

Parameters:key (string) – The key to delete in Redis.
Returns:The response from Redis.
Return type:(string)
hget(key)[source]

Read data from Redis for the provided key.

Parameters:key (string) – The key to read in Redis.
Returns:The response data from Redis.
Return type:(any)
hgetall()[source]

Read data from Redis for the provided key.

Parameters:key (string) – The key to read in Redis.
Returns:The response data from Redis.
Return type:(any)
hset(key, value)[source]

Create key/value pair in Redis.

Parameters:
  • key (string) – The key to create in Redis.
  • value (any) – The value to store in Redis.
Returns:

The response from Redis.

Return type:

(string)

read(key)[source]

Alias for hget method.

rpush(name, values)[source]

Append/Push values to the end of list name.

Parameters:
  • name (string) – The channel/name of the list.
  • timeout (int) – The number of seconds to wait before blocking stops.
Returns:

The response from Redis.

Return type:

(string)