@tramvai/module-dns-cache 3.7.0 → 3.9.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.
- package/lib/server.es.js +16 -1
- package/lib/server.js +16 -1
- package/package.json +4 -4
package/lib/server.es.js
CHANGED
|
@@ -96,7 +96,22 @@ const TramvaiDnsCacheModule = declareModule({
|
|
|
96
96
|
useFactory: ({ createCache, envManager }) => {
|
|
97
97
|
const max = Number(envManager.get('DNS_LOOKUP_CACHE_LIMIT'));
|
|
98
98
|
const ttl = Number(envManager.get('DNS_LOOKUP_CACHE_TTL'));
|
|
99
|
-
|
|
99
|
+
const cache = createCache('memory', { max, ttl });
|
|
100
|
+
const adapter = {
|
|
101
|
+
set: (hostname, entries, ttl) => {
|
|
102
|
+
return cache.set(hostname, entries, { ttl });
|
|
103
|
+
},
|
|
104
|
+
get: (hostname) => {
|
|
105
|
+
return cache.get(hostname);
|
|
106
|
+
},
|
|
107
|
+
delete: (hostname) => {
|
|
108
|
+
return cache.delete(hostname);
|
|
109
|
+
},
|
|
110
|
+
clear: () => {
|
|
111
|
+
return cache.clear();
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
return adapter;
|
|
100
115
|
},
|
|
101
116
|
deps: {
|
|
102
117
|
createCache: CREATE_CACHE_TOKEN,
|
package/lib/server.js
CHANGED
|
@@ -108,7 +108,22 @@ const TramvaiDnsCacheModule = core.declareModule({
|
|
|
108
108
|
useFactory: ({ createCache, envManager }) => {
|
|
109
109
|
const max = Number(envManager.get('DNS_LOOKUP_CACHE_LIMIT'));
|
|
110
110
|
const ttl = Number(envManager.get('DNS_LOOKUP_CACHE_TTL'));
|
|
111
|
-
|
|
111
|
+
const cache = createCache('memory', { max, ttl });
|
|
112
|
+
const adapter = {
|
|
113
|
+
set: (hostname, entries, ttl) => {
|
|
114
|
+
return cache.set(hostname, entries, { ttl });
|
|
115
|
+
},
|
|
116
|
+
get: (hostname) => {
|
|
117
|
+
return cache.get(hostname);
|
|
118
|
+
},
|
|
119
|
+
delete: (hostname) => {
|
|
120
|
+
return cache.delete(hostname);
|
|
121
|
+
},
|
|
122
|
+
clear: () => {
|
|
123
|
+
return cache.clear();
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
return adapter;
|
|
112
127
|
},
|
|
113
128
|
deps: {
|
|
114
129
|
createCache: tokensCommon.CREATE_CACHE_TOKEN,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-dns-cache",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "DNS lookup cache",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@tinkoff/utils": "^2.1.2",
|
|
27
|
-
"@tramvai/core": "3.
|
|
28
|
-
"@tramvai/tokens-common": "3.
|
|
29
|
-
"@tramvai/tokens-http-client": "3.
|
|
27
|
+
"@tramvai/core": "3.9.0",
|
|
28
|
+
"@tramvai/tokens-common": "3.9.0",
|
|
29
|
+
"@tramvai/tokens-http-client": "3.9.0",
|
|
30
30
|
"cacheable-lookup": "^7.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {},
|