Redis adapter for waterline
A Sails/Waterline adapter for Redis. May be used in a Sails app or anything using Waterline for the ORM.
waterline-redis stores indexes of unique attributes for relatively fast lookups. Collections with multiple unique constraints will create multiple index sets.
In the near future,
sails-redis will be available on npm.
Install is through NPM.
$ npm install sails-redis
The following connection configuration is available:
// default values inlineconfig:port: 6379host: 'localhost'password: nulldatabase: nulloptions:// low-level configuration// (redis driver options)parser: 'hiredis'return_buffers: falsedetect_buffers: falsesocket_nodelay: trueno_ready_check: falseenable_offline_queue: true;
Configuration for the underlying Redis driver itself is located as an object under the
options. The following options are available:
parser: which Redis protocol reply parser to use. Defaults to
hiredisif that module is installed. This may also be set to
return_buffers: defaults to
false. If set to
detect_buffers: default to
false. If set to
true, then replies will be sent to callbacks as node Buffer objects if any of the input arguments to the original command were Buffer objects. This option lets you switch between Buffers and Strings on a per-command basis, whereas
return_buffersapplies to every command on a client.
socket_nodelay: defaults to
true. Whether to call setNoDelay() on the TCP stream, which disables the Nagle algorithm on the underlying socket. Setting this option to
falsecan result in additional throughput at the cost of more latency. Most applications will want this set to
no_ready_check: defaults to
false. When a connection is established to the Redis server, the server might still be loading the database from disk. While loading, the server not respond to any commands. To work around this,
node_redishas a "ready check" which sends the
INFOcommand to the server. The response from the
INFOcommand indicates whether the server is ready for more commands. When ready,
truewill inhibit this check.
enable_offline_queue: defaults to
true. By default, if there is no active connection to the redis server, commands are added to a queue and are executed once the connection has been established. Setting
falsewill disable this feature and the callback will be execute immediately with an error, or an error will be thrown if no callback is specified.
retry_max_delay: defaults to
null. By default every time the client tries to connect and fails time before reconnection (delay) almost doubles. This delay normally grows infinitely, but setting
retry_max_delaylimits delay to maximum value, provided in milliseconds.
false. By default client will try reconnecting until connected. Setting
connect_timeoutlimits total time for client to reconnect. Value is provided in milliseconds and is counted once the disconnect occured.
null. By default client will try reconnecting until connected. Setting
max_attemptslimits total amount of reconnects.
null. By default client will try connecting without auth. If set, client will run redis auth command on connect.