graphile-cache 3.15.1 → 3.15.2
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.
- package/esm/graphile-cache.js +4 -8
- package/graphile-cache.js +4 -8
- package/package.json +4 -3
package/esm/graphile-cache.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from 'events';
|
|
2
|
+
import { parseEnvNumber } from '12factor-env';
|
|
2
3
|
import { Logger } from '@pgpmjs/logger';
|
|
3
4
|
import { LRUCache } from 'lru-cache';
|
|
4
5
|
import { pgCache } from 'pg-cache';
|
|
@@ -31,14 +32,9 @@ export const cacheEvents = new CacheEventEmitter();
|
|
|
31
32
|
*/
|
|
32
33
|
export function getCacheConfig() {
|
|
33
34
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
34
|
-
const max = process.env.GRAPHILE_CACHE_MAX
|
|
35
|
-
|
|
36
|
-
:
|
|
37
|
-
const ttl = process.env.GRAPHILE_CACHE_TTL_MS
|
|
38
|
-
? parseInt(process.env.GRAPHILE_CACHE_TTL_MS, 10)
|
|
39
|
-
: isDevelopment
|
|
40
|
-
? FIVE_MINUTES_MS
|
|
41
|
-
: ONE_YEAR;
|
|
35
|
+
const max = parseEnvNumber(process.env.GRAPHILE_CACHE_MAX) ?? 50;
|
|
36
|
+
const ttl = parseEnvNumber(process.env.GRAPHILE_CACHE_TTL_MS) ??
|
|
37
|
+
(isDevelopment ? FIVE_MINUTES_MS : ONE_YEAR);
|
|
42
38
|
return { max, ttl };
|
|
43
39
|
}
|
|
44
40
|
// Track disposed entries to prevent double-disposal
|
package/graphile-cache.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.getCacheConfig = getCacheConfig;
|
|
|
5
5
|
exports.getCacheStats = getCacheStats;
|
|
6
6
|
exports.clearMatchingEntries = clearMatchingEntries;
|
|
7
7
|
const events_1 = require("events");
|
|
8
|
+
const _12factor_env_1 = require("12factor-env");
|
|
8
9
|
const logger_1 = require("@pgpmjs/logger");
|
|
9
10
|
const lru_cache_1 = require("lru-cache");
|
|
10
11
|
const pg_cache_1 = require("pg-cache");
|
|
@@ -38,14 +39,9 @@ exports.cacheEvents = new CacheEventEmitter();
|
|
|
38
39
|
*/
|
|
39
40
|
function getCacheConfig() {
|
|
40
41
|
const isDevelopment = process.env.NODE_ENV === 'development';
|
|
41
|
-
const max = process.env.GRAPHILE_CACHE_MAX
|
|
42
|
-
|
|
43
|
-
:
|
|
44
|
-
const ttl = process.env.GRAPHILE_CACHE_TTL_MS
|
|
45
|
-
? parseInt(process.env.GRAPHILE_CACHE_TTL_MS, 10)
|
|
46
|
-
: isDevelopment
|
|
47
|
-
? exports.FIVE_MINUTES_MS
|
|
48
|
-
: ONE_YEAR;
|
|
42
|
+
const max = (0, _12factor_env_1.parseEnvNumber)(process.env.GRAPHILE_CACHE_MAX) ?? 50;
|
|
43
|
+
const ttl = (0, _12factor_env_1.parseEnvNumber)(process.env.GRAPHILE_CACHE_TTL_MS) ??
|
|
44
|
+
(isDevelopment ? exports.FIVE_MINUTES_MS : ONE_YEAR);
|
|
49
45
|
return { max, ttl };
|
|
50
46
|
}
|
|
51
47
|
// Track disposed entries to prevent double-disposal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-cache",
|
|
3
|
-
"version": "3.15.
|
|
3
|
+
"version": "3.15.2",
|
|
4
4
|
"author": "Constructive <developers@constructive.io>",
|
|
5
5
|
"description": "PostGraphile v5 LRU cache with automatic pool cleanup integration",
|
|
6
6
|
"main": "index.js",
|
|
@@ -29,12 +29,13 @@
|
|
|
29
29
|
"test:watch": "jest --watch"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
+
"12factor-env": "^1.17.1",
|
|
32
33
|
"@pgpmjs/logger": "^2.14.0",
|
|
33
34
|
"express": "^5.2.1",
|
|
34
35
|
"grafserv": "1.0.0",
|
|
35
36
|
"graphile-realtime-subscriptions": "^0.10.0",
|
|
36
37
|
"lru-cache": "^11.2.7",
|
|
37
|
-
"pg-cache": "^3.15.
|
|
38
|
+
"pg-cache": "^3.15.2",
|
|
38
39
|
"postgraphile": "5.0.3"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
@@ -52,5 +53,5 @@
|
|
|
52
53
|
"constructive",
|
|
53
54
|
"v5"
|
|
54
55
|
],
|
|
55
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "e53a570a4a70987e82dc074bd73501971fd82828"
|
|
56
57
|
}
|