Wondering what’s next for npm?Check out our public roadmap! »

    rate-limit-memcached
    TypeScript icon, indicating that this package has built-in type declarations

    0.6.0 • Public • Published

    Rate Limit Memcached

    Memcached client for the express-rate-limit middleware.

    Installation

    $ npm install --save rate-limit-memcached

    Usage

    Node.js

    var RateLimit = require('express-rate-limit');
    var Memcached = require('memcached');
    var MemcachedStore = require('rate-limit-memcached');
     
    var client = new Memcached(['memcached.example.com:11211']);
    var expiration = 20 * 60;
    var limiter = new RateLimit({
      store: new MemcachedStore({ expiration: expiration, client: client, prefix: 'remoteip:' }),
      windowMs: expiration * 1000,
      max: 500,
      delayMs: 0
    });
     
    app.use(limiter);

    TypeScript

    import * as RateLimit from 'express-rate-limit'
    import * as Memcached from 'memcached'
    import MemcachedStore from 'rate-limit-memcached'
     
    const client = new Memcached(['memcached.example.com:11211'])
    const expiration = 20 * 60
    const limiter = new RateLimit({
      store: new MemcachedStore({ expiration, client, prefix: 'remoteip:' }),
      windowMs: expiration * 1000,
      max: 500,
      delayMs: 0
    })
     
    app.use(limiter)

    Contribution

    1. Fork (https://github.com/linyows/rate-limit-memcached/fork)
    2. Create a feature branch
    3. Commit your changes
    4. Rebase your local changes against the master branch
    5. Run test suite with the npm ci command and confirm that it passes
    6. Create a new Pull Request

    Author

    linyows

    Install

    npm i rate-limit-memcached

    DownloadsWeekly Downloads

    434

    Version

    0.6.0

    License

    MIT

    Last publish

    Collaborators

    • avatar