feat: implement API response caching with node-cache
- Add in-memory cache middleware with configurable TTL - Cache GET endpoints: streets (5min), events (2min), posts (1min), rewards (10min) - Automatic cache invalidation on POST/PUT/DELETE operations - Add cache statistics endpoint (GET /api/cache/stats) - Add cache management endpoint (DELETE /api/cache) - Cache hit rate tracking and monitoring - Pattern-based cache invalidation - Optimized for Raspberry Pi deployment (lightweight in-memory) 🤖 Generated with Claude Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Generated
+49
-1
@@ -15,6 +15,7 @@
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.7",
|
||||
"express": "^4.21.2",
|
||||
"express-mongo-sanitize": "^2.2.0",
|
||||
"express-rate-limit": "^8.2.1",
|
||||
"express-validator": "^7.3.0",
|
||||
"globals": "^16.4.0",
|
||||
@@ -22,8 +23,10 @@
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"nano": "^10.1.4",
|
||||
"node-cache": "^5.1.2",
|
||||
"socket.io": "^4.8.1",
|
||||
"stripe": "^17.7.0"
|
||||
"stripe": "^17.7.0",
|
||||
"xss-clean": "^0.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^30.0.0",
|
||||
@@ -2055,6 +2058,15 @@
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/clone": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
|
||||
"integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/cloudinary": {
|
||||
"version": "2.8.0",
|
||||
"license": "MIT",
|
||||
@@ -2755,6 +2767,15 @@
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/express-mongo-sanitize": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/express-mongo-sanitize/-/express-mongo-sanitize-2.2.0.tgz",
|
||||
"integrity": "sha512-PZBs5nwhD6ek9ZuP+W2xmpvcrHwXZxD5GdieX2dsjPbAbH4azOkrHbycBud2QRU+YQF1CT+pki/lZGedHgo/dQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/express-rate-limit": {
|
||||
"version": "8.2.1",
|
||||
"license": "MIT",
|
||||
@@ -4396,6 +4417,18 @@
|
||||
"version": "3.1.1",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-cache": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/node-cache/-/node-cache-5.1.2.tgz",
|
||||
"integrity": "sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"clone": "2.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-int64": {
|
||||
"version": "0.4.0",
|
||||
"dev": true,
|
||||
@@ -5852,6 +5885,21 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/xss-clean": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/xss-clean/-/xss-clean-0.1.4.tgz",
|
||||
"integrity": "sha512-4hArTFHYxrifK9VXOu/zFvwjTXVjKByPi6woUHb1IqxlX0Z4xtFBRjOhTKuYV/uE1VswbYsIh5vUEYp7MmoISQ==",
|
||||
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"xss-filters": "1.2.7"
|
||||
}
|
||||
},
|
||||
"node_modules/xss-filters": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/xss-filters/-/xss-filters-1.2.7.tgz",
|
||||
"integrity": "sha512-KzcmYT/f+YzcYrYRqw6mXxd25BEZCxBQnf+uXTopQDIhrmiaLwO+f+yLsIvvNlPhYvgff8g3igqrBxYh9k8NbQ=="
|
||||
},
|
||||
"node_modules/xtend": {
|
||||
"version": "4.0.2",
|
||||
"license": "MIT",
|
||||
|
||||
Reference in New Issue
Block a user