Skip to content

Commit

Permalink
redis
Browse files Browse the repository at this point in the history
  • Loading branch information
deptno committed Jan 29, 2024
1 parent f67b3b9 commit 29fd82c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions diary/2024-01-30.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
- [[../redis|redis]]
```sh
[ErrorReply: ERR Can't execute 'zincrby': only (P|S)SUBSCRIBE / (P|S)UNSUBSCRIBE / PING / QUIT / RESET are allowed in this context]
```
- pub, sub 을 이용하는 경우 클라이언트 인스턴스를 분리해야한다
- [[../redis|redis]] 는 [[../postgresql|postgresql]] 과는 다르게 기본 env 설정을 읽거나 하지 않는다. 인자로 명시한다
- 기본설정에 이벤트가 꺼져있다면 런타임에 `CONFIG SET` 을 통해 설정해줘야한다
```javascript
await client.configSet('notify-keyspace-events', 'Ex')
await client.subscribe('__keyevent@0__:expired', (message, channel) => {
console.log({ message, channel })
})
```
- `setEx` = `set` + expire

0 comments on commit 29fd82c

Please sign in to comment.