@platformatic/next 2.19.0-alpha.2 → 2.19.0-alpha.3

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.
@@ -14,7 +14,6 @@ const sections = {
14
14
  tags: 'tags'
15
15
  }
16
16
 
17
- const kReferences = Symbol('references')
18
17
  const clients = new Map()
19
18
 
20
19
  export function keyFor (prefix, subprefix, section, key) {
@@ -28,27 +27,14 @@ export function getConnection (url) {
28
27
 
29
28
  if (!client) {
30
29
  client = new Redis(url, { enableAutoPipelining: true })
31
- client[kReferences] = 0
32
30
  clients.set(url, client)
33
- }
34
-
35
- client[kReferences]++
36
- return client
37
- }
38
31
 
39
- export function releaseConnection (url) {
40
- const client = clients.get(url)
41
-
42
- if (!client) {
43
- return
32
+ globalThis.platformatic.events.on('plt:next:close', () => {
33
+ client.disconnect(false)
34
+ })
44
35
  }
45
36
 
46
- client[kReferences]--
47
-
48
- if (client[kReferences] < 1) {
49
- client.disconnect(false)
50
- clients.remove(url)
51
- }
37
+ return client
52
38
  }
53
39
 
54
40
  export class CacheHandler {
@@ -64,11 +50,6 @@ export class CacheHandler {
64
50
  this.#store = getConnection(this.#config.url)
65
51
  this.#maxTTL = this.#config.maxTTL
66
52
  this.#subprefix = this.#getSubprefix()
67
-
68
- // Handle disconnection not to hang the process on exit
69
- globalThis.platformatic.events.on('plt:next:close', () => {
70
- releaseConnection(this.#config.url)
71
- })
72
53
  }
73
54
 
74
55
  async get (cacheKey) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/next",
3
- "version": "2.19.0-alpha.2",
3
+ "version": "2.19.0-alpha.3",
4
4
  "description": "Platformatic Next.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -22,9 +22,9 @@
22
22
  "iovalkey": "^0.2.1",
23
23
  "msgpackr": "^1.11.2",
24
24
  "semver": "^7.6.3",
25
- "@platformatic/basic": "2.19.0-alpha.2",
26
- "@platformatic/config": "2.19.0-alpha.2",
27
- "@platformatic/utils": "2.19.0-alpha.2"
25
+ "@platformatic/basic": "2.19.0-alpha.3",
26
+ "@platformatic/config": "2.19.0-alpha.3",
27
+ "@platformatic/utils": "2.19.0-alpha.3"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@fastify/reply-from": "^11.0.0",
@@ -38,8 +38,8 @@
38
38
  "react-dom": "^18.3.1",
39
39
  "typescript": "^5.5.4",
40
40
  "ws": "^8.18.0",
41
- "@platformatic/composer": "2.19.0-alpha.2",
42
- "@platformatic/service": "2.19.0-alpha.2"
41
+ "@platformatic/composer": "2.19.0-alpha.3",
42
+ "@platformatic/service": "2.19.0-alpha.3"
43
43
  },
44
44
  "scripts": {
45
45
  "test": "npm run lint && borp --concurrency=1 --no-timeout",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/next/2.19.0-alpha.2.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/next/2.19.0-alpha.3.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Next.js Stackable",
5
5
  "type": "object",