Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

route-cache

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

route-cache - npm Package Compare versions

Comparing version 0.2.8 to 0.3.0

test/ttls.js

14

index.js
'use strict'
var Eidetic = require('eidetic')
var cacheStore = new Eidetic({
maxSize: 50,
canPutWhenFull: true
var LRU = require('lru-cache')
var cacheStore = new LRU({
maxSize: 500,
maxAge: 30
})

@@ -11,3 +11,5 @@

module.exports.cacheSeconds = function (ttl) {
module.exports.cacheSeconds = function (secondsTTL) {
var ttl = secondsTTL * 1000
return function (req, res, next) {

@@ -56,3 +58,3 @@ var key = req.originalUrl

var body = data instanceof Buffer ? data.toString() : data
if (res.statusCode < 400) cacheStore.put(key, { body: body, isJson: isJson }, ttl)
if (res.statusCode < 400) cacheStore.set(key, { body: body, isJson: isJson }, ttl)

@@ -59,0 +61,0 @@ // drain the queue so anyone else waiting for

@@ -7,3 +7,3 @@ // app.js

var CACHE_TTL = 20
var HIT_CNT = 0 // for debugging back-pressure valve
var HIT_CNT = 1 // for debugging back-pressure valve

@@ -10,0 +10,0 @@ if (process.argv[3]) {

{
"name": "route-cache",
"version": "0.2.8",
"version": "0.3.0",
"description": "express middleware for caching your routes",

@@ -22,3 +22,3 @@ "main": "index.js",

"dependencies": {
"eidetic": "^0.3.1"
"lru-cache": "4.0.1"
},

@@ -25,0 +25,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc