{"id":19782099,"url":"https://github.com/express-rate-limit/rate-limit-memcached","last_synced_at":"2025-04-30T22:30:39.807Z","repository":{"id":65411565,"uuid":"113965930","full_name":"express-rate-limit/rate-limit-memcached","owner":"express-rate-limit","description":"A rate limiting store for express-rate-limit with Memcached","archived":false,"fork":false,"pushed_at":"2024-04-10T18:17:14.000Z","size":773,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-06T05:32:25.349Z","etag":null,"topics":["api","express","memcached","nodejs","rate-limiting","typescript"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/express-rate-limit.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-12T08:48:34.000Z","updated_at":"2024-11-07T15:32:30.000Z","dependencies_parsed_at":"2024-04-10T19:39:53.420Z","dependency_job_id":"c10d0a7e-0198-49bb-89bc-522a77a9b833","html_url":"https://github.com/express-rate-limit/rate-limit-memcached","commit_stats":null,"previous_names":["linyows/rate-limit-memcached"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-rate-limit%2Frate-limit-memcached","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-rate-limit%2Frate-limit-memcached/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-rate-limit%2Frate-limit-memcached/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/express-rate-limit%2Frate-limit-memcached/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/express-rate-limit","download_url":"https://codeload.github.com/express-rate-limit/rate-limit-memcached/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251791438,"owners_count":21644396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","express","memcached","nodejs","rate-limiting","typescript"],"created_at":"2024-11-12T06:03:49.524Z","updated_at":"2025-04-30T22:30:39.495Z","avatar_url":"https://github.com/express-rate-limit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cdiv align=\"center\"\u003e `rate-limit-memcached` \u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![tests](https://github.com/express-rate-limit/rate-limit-memcached/actions/workflows/ci.yaml/badge.svg)](https://github.com/express-rate-limit/rate-limit-memcached/actions/workflows/ci.yaml)\n[![npm version](https://img.shields.io/npm/v/rate-limit-memcached.svg)](https://npmjs.org/package/rate-limit-memcached 'View this project on NPM')\n[![npm downloads](https://img.shields.io/npm/dm/rate-limit-memcached)](https://www.npmjs.com/package/rate-limit-memcached)\n\nA [`memcached`](https://memcached.org) store for the\n[`express-rate-limit`](https://github.com/express-rate-limit/express-rate-limit)\nmiddleware.\n\n\u003c/div\u003e\n\n## Installation\n\nFrom the npm registry:\n\n```sh\n# Using npm\n\u003e npm install express-rate-limit\n# Using yarn or pnpm\n\u003e yarn/pnpm add express-rate-limit\n```\n\nFrom Github Releases:\n\n```sh\n# Using npm\n\u003e npm install https://github.com/express-rate-limit/rate-limit-memcached/releases/download/v{version}/rate-limit-memcached.tgz\n# Using yarn or pnpm\n\u003e yarn/pnpm add https://github.com/express-rate-limit/rate-limit-memcached/releases/download/v{version}/rate-limit-memcached.tgz\n```\n\nReplace `{version}` with the version of the package that you want to your, e.g.:\n`1.0.0`.\n\n## Usage\n\n**This package requires you to use Node 16 or above.**\n\nAn example of its usage is as follows:\n\n```ts\nimport { rateLimit } from 'express-rate-limit'\nimport { MemcachedStore } from 'rate-limit-memcached'\n\nconst limiter = rateLimit({\n\twindowMs: 15 * 60 * 1000, // 15 minutes.\n\tmax: 100, // Limit each IP to 100 requests per `window` (here, per 15 minutes).\n\tstandardHeaders: 'draft-7', // Return rate limit info in the `RateLimit` header.\n\tlegacyHeaders: false, // Disable the `X-RateLimit-*` headers.\n\tstore: new MemcachedStore({\n\t\t// prefix: 'rl:', // The prefix attached to all keys stored in the cache.\n\t\tlocations: ['localhost:11211'], // The server location(s), passed directly to Memcached.\n\t}),\n})\n\n// Apply the rate limiting middleware to all requests\napp.use(limiter)\n```\n\n## Configuration\n\n### `prefix`\n\n\u003e `string`\n\nThe text to prepend to all keys stored by this package in Memcached.\n\nDefaults to `rl:`.\n\n### `client`\n\n\u003e `MemcachedClient`\n\nThe client used to make requests to the Memcached server. Must have the\nfollowing methods:\n\n- `get: (key, callback)`\n- `del: (key, callback)`\n- `set: (key, value, lifetime, callback)`\n- `add: (key, value, lifetime, callback)`\n- `incr: (key, delta, callback)`\n- `decr: (key, delta, callback)`\n\n\u003e Here, `key` is a string, `value` and `delta` are numbers, and `lifetime` is\n\u003e the time in seconds until it expires.\n\nDefaults to an instance of [`memcached`](https://github.com/3rd-Eden/memcached),\ncreated with the `locations` and `config` options (see below for details) passed\nto it.\n\n### `locations`\n\nA list of memcached servers to store the keys in, passed to the default\nMemcached client.\n\nNote that the default client is only used if an alternative `client` is not\npassed to the store.\n\nDefaults to `['localhost:11211']`.\n\n### `config`\n\n\u003e `object`\n\nThe configuration passed to the default Memcached client.\n\nDefaults to `{}`.\n\n## Issues and Contributing\n\nIf you encounter a bug or want to see something added/changed, please go ahead\nand\n[open an issue](https://github.com/express-rate-limitedly/rate-limit-memcached/issues/new)!\nIf you need help with something, feel free to\n[start a discussion](https://github.com/express-rate-limit/rate-limit-memcached/discussions/new)!\n\nIf you wish to contribute to the library, thanks! First, please read\n[the contributing guide](contributing.md). Then you can pick up any issue and\nfix/implement it!\n\n## License\n\nMIT © [Tomohisa Oda](http://github.com/linyows),\n[Nathan Friedly](http://nfriedly.com) and\n[Vedant K](https://github.com/gamemaker1)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpress-rate-limit%2Frate-limit-memcached","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexpress-rate-limit%2Frate-limit-memcached","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexpress-rate-limit%2Frate-limit-memcached/lists"}