Skip to content

Commit

Permalink
TTL generation callback information added
Browse files Browse the repository at this point in the history
  • Loading branch information
Movwf committed May 11, 2023
1 parent 1a24b83 commit d573ec0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ If the session cookie has a `expires` date, `connect-redis` will use it as the T

Otherwise, it will expire the session using the `ttl` option (default: `86400` seconds or one day).

```ts
interface RedisStoreOptions {
...
ttl?: number | {(sess: SessionData): number}
}
```

`ttl` also has external callback support. You can use it for dynamic TTL generation. It has access to `session` data.

**Note**: The TTL is reset every time a user interacts with the server. You can disable this behavior in _some_ instances by using `disableTouch`.

**Note**: `express-session` does not update `expires` until the end of the request life cycle. _Calling `session.save()` manually beforehand will have the previous value_.
Expand Down

0 comments on commit d573ec0

Please sign in to comment.