metronom / Modules / Metronom / default
Class: default
Metronom.default
Metronom model creator
Table of contents
Properties
Constructors
Methods
Properties
redisClientOptions
• Optional
redisClientOptions: RedisClientOptions
<Record
<string
, never
>, Record
<string
, never
>>
Defined in
log
• Optional
log: boolean
| LogLevels
Defined in
#redisClient
• Private
#redisClient: null
| IRedisAdaptor
Defined in
Constructors
constructor
• new default(options
)
Base Metronom object. You can create new metronom instance with diffirent options like redis url.
Parameters
Name | Type | Description |
---|---|---|
options | MetronomOptions | redis client settings |
Methods
define
▸ define(schema
, keyPrefix?
, modelOptions?
): default
Create metronom model from this Metronom object
Parameters
Name | Type | Default value | Description |
---|---|---|---|
schema | Schema | undefined | Record's key-value schema |
keyPrefix | string | 'object' | Record unique key's prefix. "users:1234" --> "keyPrefix :keyUnique " |
modelOptions? | ModelOptions | undefined | - |
Returns
new record of Model
setKey
▸ setKey(key
, value
): Promise
<string
>
Create String key or update if it exist. Redis's "SET" command
Parameters
Name | Type | Description |
---|---|---|
key | string | redis key |
value | any | value |
Returns
Promise
<string
>
it return "OK" if the process done
getKey
▸ getKey(key
): Promise
<null
| string
>
Read String key Redis's "GET" command
Parameters
Name | Type | Description |
---|---|---|
key | string | Redis key |
Returns
Promise
<null
| string
>
if the key is exist it return the value else return null