Client connection
The client wraps a redis connection and provides access to records definition and manipulation.
Internally, Ron use the Redis client for Node.js.
ron([options]) Client creation
options Options properties include:
nameA namespace for the application, all keys with be prefixed with “#{name}:”. Default to “ron”redisProvide an existing instance in case you don’t want a new one to be created.hostRedis hostname.portRedis port.passwordRedis password.databaseRedis database (an integer).
Basic example:
1 2 3 4 | |
get(schema) Records definition and access
Return a records instance. If the schema argument is an object, a new
instance will be created overwriting any previously defined instance
with the same name.
schema An object defining a new schema or a string referencing a schema name.
Define a record from a object:
1 2 3 4 5 6 | |
Define a record from function calls:
1 2 3 4 | |
Alternatively, the function could be called with a string followed by multiple schema definition that will be merged. Here is a valid example:
1
| |
quit(callback) Quit
Destroy the redis connection.
callback Received parameters are:
errError object if any.statusStatus provided by the redis driver