Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a section about expiration time on keys #1752

Merged
merged 1 commit into from
Apr 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ async function listenForMessage(lastId = "$") {
listenForMessage();
```

## Expiration

Redis can set a timeout to expire your key, after the timeout has expired the key will be automatically deleted. (You can find the [official Expire documentation](https://redis.io/commands/expire/) to understand better the different parameters you can use), to set your key to expire in 1000 seconds, we will have the following code:

```javascript
redis.set("key", "data", "EX", 1000);
// Equivalent to redis command "SET key data EX 1000", because on ioredis set method,
// all arguments are passed directly to the redis server.
```

## Handle Binary Data

Binary data support is out of the box. Pass buffers to send binary data:
Expand Down