5.3.7. vlcp.protocol.redis

Note

This document is generated from the source file.

View Source on GitHub

Created on 2016/1/5

author:hubo
class vlcp.protocol.redis.Redis

Redis (RESP) Protocol

__init__()

Constructor

batch_execute(connection, container, *cmds, raise_first_exception=False)

Send multiple commands to redis server at once, and get responses

Parameters:
  • connection – redis connection
  • container – routine container
  • *cmds – commands to send. Each command is a tuple/list of bytes/str.
  • raise_first_exception – if True, the first exception is raised. if False, exceptions are returned in the list.
Returns:

list of replies.

closed(connection)

routine for connection closed

error(connection)

routine for connection error

execute_command(connection, container, *args)

Send command to Redis server and wait for response

Parameters:
  • connection – Redis connection
  • container – routine container
  • *args – command paramters, begin with command name, e.g. ‘SET’,`’key’,’value’`
Returns:

Response from Redis server

Raises:

RedisReplyException – Redis server returns an error (e.g. “-ERR …”)

init(connection)

routine for connection initialization

keepalive(connection)

routine executed when there has been a long time since last data arrival. Check if the connection is down.

notconnected(connection)

routine for connect failed and not retrying

parse(connection, data, laststart)

Parse input data into events

Parameters:
  • connection – connection object
  • data – view for input data
  • laststart – last parsed position
Returns:

(events, keep) where events are parsed events to send, keep is the unused data length to be keeped for next parse.

reconnect_init(connection)

routine for reconnect

replymatcher(requestid, connection, iserror=None)

Create an event matcher to match

send_batch(connection, container, *cmds)

Send multiple commands to redis server at once

Parameters:
  • connection – redis connection
  • container – routine container
  • *cmds – commands to send. Each command is a tuple/list of bytes/str.
Returns:

list of reply event matchers

send_command(connection, container, *args)

Send command to Redis server.

Parameters:
  • connection – Redis connection
  • container – routine container
  • *args – command paramters, begin with command name, e.g. ‘SET’,`’key’,’value’`
Returns:

Event matcher to wait for reply

class vlcp.protocol.redis.RedisConnectionStateEvent(*args, **kwargs)
class vlcp.protocol.redis.RedisParser

Python implemented hiredis.Reader()

__init__()

Initialize self. See help(type(self)) for accurate signature.

exception vlcp.protocol.redis.RedisProtocolException
exception vlcp.protocol.redis.RedisReplyException(*args, **kwargs)
__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

class vlcp.protocol.redis.RedisResponseEvent(*args, **kwargs)
class vlcp.protocol.redis.RedisSubscribeEvent(*args, **kwargs)
class vlcp.protocol.redis.RedisSubscribeMessageEvent(*args, **kwargs)