Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
express-idempotency-redis-adapter
Advanced tools
Readme
Use Redis to store data related to the express idempotency middleware.
Allow the express-idempotency to store data in a Redis data store.
This is a Node.js module designed to work with Express, available through the NPM registry.
Install the dependency.
$ npm install express-idempotency-redis-adapter
Integrate the data adapter during the middleware initialization.
const idempotency = require("express-idempotency");
const RedisAdapter = require("express-idempotency-redis-adapter").default;
// New Redis Adapter that will be used by the idempotency middleware
const adapter = new RedisAdapter({
connectionConfig: { url: "redis://localhost:6379" },
});
adapter.connect().catch((error) => {
throw error;
});
// Add the idempotency middleware by specifying the use of the redis adapter
app.use(
idempotency.idempotency({
dataAdapter: adapter,
})
);
The data adapter will take care of everything required to store data from the express idempotency middleware.
You can optionally configure the data adapter by providing options during initialization.
Property | Mandatory | Default | Description |
---|---|---|---|
ttl | false | 86400 | Time to live, in seconds. It will remove a resource after a certain period of time. Default is 86400 (1 day) |
connectionConfig | false | Node-Redis client configuration settings. See: https://github.com/redis/node-redis/blob/master/docs/client-configuration.md | |
connectionInstance | false | Existing instance of Node-Redis |
Note: You can only pass either
connectionConfig
orconnectionInstance
The data adapter can manage connection itself by providing a Redis configuration. It will use the node-redis package.
You might want to manage connection externally by having a singleton client. In this case, you can provide an existing instance of node-redis
to the data adapter.
The data adapter will create TTL indexes to purge data from collection after a certain period of time. By default, the ttl is 1 day
but it is configurable.
The source code of this project is distributed under the MIT License.
FAQs
Use Redis to store data related to the express idempotency middleware.
The npm package express-idempotency-redis-adapter receives a total of 45 weekly downloads. As such, express-idempotency-redis-adapter popularity was classified as not popular.
We found that express-idempotency-redis-adapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.