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

express-throttle-redis

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-throttle-redis

Redis wrapper for express-throttle

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
31
decreased by-46.55%
Maintainers
1
Weekly downloads
 
Created
Source

express-throttle-redis

Redis wrapper for express-throttle

npm version

Installation

$ npm install express-throttle-redis

Usage

var express = require("express");
var throttle = require("express-throttle");
var redis = require("redis");
var RedisStore = require("express-throttle-redis");

var app = express();

// Rolling window
app.post("/search", throttle({
  "burst": 10,
	"rate": "5/s",
	"store": new RedisStore(redis.createClient())
}), function(req, res, next) {
	// ...
})

// Fixed window
app.post("/search", throttle({
  "burst": 10,
  "period": "1min",
  "store": new RedisStore(redis.createClient())
}), function(req, res, next) {
  // ...
})

Neither express-throttle nor express-throttle-redis will expire / remove / cleanup any keys. This means that memory usage will grow unbounded as new requests are being processed. Thus, it is recommended to have a separate redis instance only for throttling purposes with a sensible maxmemory setting and maxmemory-policy set to allkeys-lru. Furthermore, you may want to disable the persistence layer altogether. Consult the Redis documentation for more information.

Keywords

FAQs

Package last updated on 18 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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