Skip to content

Request TTL #2

@ericclemmons

Description

@ericclemmons

What do you think about returning the remaining TTL with the cache object as well?

I need to be able to say "3 minutes old" or similar, so the user knows if they should force a refresh or not.

From what I can tell, the best way (that works across all stores) is to store the request payload with the TTL information (TTL + UNIX timestamp) so that it can be returned/calculated when retrieving from the cache:

https://github.com/matteoagosti/node-request-caching/blob/master/lib/store/redis.js#L41

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions