The following filter types are supported for Redis connections:
Request logger - Redis: logs requests to stdout, to a file, or to a logger
Response logger - Redis: logs responses to stdout, to a file, or to a logger
context.packet: the current Redis object request or response, always one of the 5 Redis types. For requests, this is always an Array.
context.connectionContext.lastRequest: in a response filter, an array containing the request for which this is the response
context.redisUtil: see below
The context.redisUtil object
This object has the following methods:
object createObject(string type, object value)
Creates a new Redis object that can be added to or inserted into a request or a response.
The type parameter must be one of the Redis types, namely: "SimpleString", "BulkString", "Error", "Integer", "Array".
The same effect can be accomplished with the following methods:
Creates a new Redis SimpleString from the given object. SimpleString are rarely used.
Creates a new Redis BulkString from the given object. BulkStrings are the most common type of strings in Redis.
Creates a new Redis Integer from the given object, which should be a number or a string representation of a number. If the number has decimals, it is rounded down.
Creates a new Redis Array. If a value is passed in, it is added to the new array, unless it is itself an array, in which case its contents will be added to the new array.
Creates a new Redis Error object with the given value, which should be a string.
null, then null is returned
a string, then a RedisBulkString is returned
a number, then a RedisInteger is returned (rounded down if the number has decimals)
a boolean, then a RedisBulkString is returned with value "true" or "false"
an object, then a RedisArray is returned in the format of a HashMap for Redis, namely an array with key and value pairs, where the keys are RedisBulkStrings, and the values are converted to Redis objects
an array, then a RedisArray is returned, containing whatever was in the given array, converted to Redis objects
Create an array and put it in the current request or response:
Create a complex object:
This will return the following Redis Array, in which a string is a BulkString, a number is an Integer, and an array is an Array: