Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
add a section about expiration on redis
  • Loading branch information
ArthurPedroti committed Apr 25, 2023
1 parent 4c8eb84 commit 3efa5e8
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 3efa5e8

Please sign in to comment.