diff --git a/lib/proxy.mjs b/lib/proxy.mjs index 49ebbd8..48c02e8 100755 --- a/lib/proxy.mjs +++ b/lib/proxy.mjs @@ -12,6 +12,9 @@ import cluster from 'cluster'; import hash from 'object-hash'; import safe from 'safetimeout'; import * as letsencrypt from './letsencrypt.mjs'; +import { LRUCache } from 'lru-cache'; + +const routeCache = new LRUCache({ max: 5000 }); import tls from 'tls'; diff --git a/package.json b/package.json index fa488dd..6f2a385 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "le-challenge-fs": "^2.0.9", "le-store-certbot": "^2.2.3", "lodash": "^4.17.15", + "lru-cache": "^11.0.1", "node-etcd": "^7.0.0", "object-hash": "^1.3.1", "pino": "^9.4.0", diff --git a/yarn.lock b/yarn.lock index 3e30a39..3c36000 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1971,6 +1971,11 @@ lru-cache@2: resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-2.7.3.tgz" integrity sha1-bUUk6LlV+V1PW1iFHOId1y+06VI= +lru-cache@^11.0.1: + version "11.0.1" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-11.0.1.tgz#3a732fbfedb82c5ba7bca6564ad3f42afcb6e147" + integrity sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ== + magic-string@^0.30.10: version "0.30.11" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.11.tgz#301a6f93b3e8c2cb13ac1a7a673492c0dfd12954"