1 | # Document
|
2 | Describe all of elements in tool. (meaning, how to use...)
|
3 |
|
4 | | Element | Description |
|
5 | |---|---|
|
6 | | --- | --- |
|
7 | |[yas-redis](#user-content--yas-redis)| Execute redis command ...|
|
8 | |[yas-redis/Live](#user-content--yas-redis%2flive)| Live execute redis command ...|
|
9 |
|
10 |
|
11 | # Details
|
12 | <a id="user-content--yas-redis" name="user-content--yas-redis"></a>
|
13 | ## yas-redis
|
14 | Execute redis command
|
15 |
|
16 | ```yaml
|
17 | - yas-redis:
|
18 | title: Redis in localhost
|
19 | uri: redis://user:pass@ip:port/db
|
20 | opts: # Redis options [ioredis](https://github.com/luin/ioredis/blob/df04dd8/lib/redis/RedisOptions.ts#L184)
|
21 | pretty: false # Pretty format data. Default is true
|
22 | commands: # Redis command
|
23 | - set name "thanh 01" # - Set "thanh 01" to key "name"
|
24 | - set age 10 # - Set "10" to key "age"
|
25 | - flushdb # - flushdb, flushall
|
26 |
|
27 | - title: Cached post data # Command title
|
28 | cmd: hset post 10 '{"name": 10}' # Redis command
|
29 |
|
30 | - cmd: # Command with args for object
|
31 | - hmset
|
32 | - post
|
33 | - name: 10
|
34 | age: 11
|
35 |
|
36 | - title: Get post data in cached # Command title
|
37 | cmd: hget post 10 # Redis command
|
38 | var: post # Set result to "post" variable
|
39 |
|
40 | - cmd: !function # Write code in command
|
41 | () { # Load global variables into function. [More](https://github.com/doanthuanthanh88/yaml-scene/wiki#user-content-!tags-!function)
|
42 | await this.redis.set('name', thanh) # Need "await" when use redis functions then return value to apply to variable
|
43 | const rs = await this.redis.get('name')
|
44 | return rs
|
45 | }
|
46 | var: nameValue
|
47 |
|
48 | - Echo/Green: ${post}
|
49 | ```
|
50 |
|
51 | <br/>
|
52 |
|
53 | <a id="user-content--yas-redis%2flive" name="user-content--yas-redis%2flive"></a>
|
54 | ## yas-redis/Live
|
55 | Live execute redis command
|
56 |
|
57 | ```yaml
|
58 | - yas-redis/Live:
|
59 | uri: redis://user:pass@ip:port/db
|
60 | opts: # Redis options (ioredis).
|
61 | # - Reference to https://github.com/luin/ioredis/blob/df04dd8/lib/redis/RedisOptions.ts#L184
|
62 | pretty: false # Pretty format data
|
63 | limit: 3 # Num of line show in history
|
64 | history: true # Reset history or not
|
65 | # - true: Store commands histories
|
66 | # - false: Dont store commands histories
|
67 | # - "clean": Clean old histories before store again
|
68 | ```
|
69 |
|
70 | <br/>
|
71 |
|
72 | |
\ | No newline at end of file |