@tillstack/cache-node 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -37,8 +37,13 @@ await cache.queue('emails').push({ to: 'ada@example.com' })
37
37
  await cache.queue<{ to: string }>('emails').consume(async (msg) => {
38
38
  await sendEmail(msg.body.to) // throw to retry; acked on success
39
39
  })
40
+
41
+ const { messages } = await cache.queue('emails').deadLetters()
42
+ await cache.queue('emails').replay({ ids: messages.map((m) => m.id) })
40
43
  ```
41
44
 
45
+ After 5 failed deliveries a message moves to the dead-letter queue, where it stays for 14 days.
46
+
42
47
  ## Pub/sub
43
48
 
44
49
  ```ts
@@ -46,6 +51,7 @@ await cache.publish('presence', { user: 'ada', status: 'online' })
46
51
 
47
52
  const stop = new AbortController()
48
53
  cache.subscribe('presence', (msg) => console.log(msg.message), { signal: stop.signal })
54
+ cache.subscribe('orders.*', (msg) => console.log(msg.channel, msg.message), { signal: stop.signal })
49
55
  ```
50
56
 
51
57
  The token only goes over https; plain http is allowed for localhost only.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillstack/cache-node",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "TillCache client for Node.js — managed KV, durable queues and pub/sub over one HTTPS endpoint, with a drop-in ioredis-compatible surface.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -24,7 +24,7 @@
24
24
  "dist"
25
25
  ],
26
26
  "dependencies": {
27
- "@tillstack/cache-core": "^0.3.0"
27
+ "@tillstack/cache-core": "^0.4.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^22.0.0",