-
Notifications
You must be signed in to change notification settings - Fork 214
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
Get metadata about the cache entries #32
Comments
Hmm, could be useful. I worry people will use it in their normal control flows instead of just for analytics. How about only when debug mode is on? |
That's a good point, it should only be for analytics (e.g. logging cache stats every minutes, etc...). I wouldn't want to turn on ps: I understand if you don't think that's the responsibility of |
That, or instead of returning the data, |
The way we'd like to use it though is for live reporting / monitoring. No runtime logic depends on it, but it still runs on production to gather and report data. For example, we can expose the age of
Some more flexible options would be logging the stats using our logging framework (Bunyan or any other), exposing the info from a |
Wow, I really dropped the ball on this. Did you solve it yourself? Thinking a bit more, adding something that makes you turn on debugging mode before you use it seems like the best option. |
Hi, no problem. We ended up maintaining another structure with the last updated date of each key. Still interested in the idea of a One option if you're not too keen is maybe finding a way to plug into |
It would be the same overhead for either. Checking a boolean or checking if there is an event callback. The boolean is simpler and I always like simplicity over extensibility, so I'd recommend that one if you coded it up I'd accept a PR. |
Sounds great thanks! Do you see |
Hmm. So |
👍 that's how I saw it, where you would not hopefully never turn on |
Hi,
It's very useful already how we can call
cache.size()
. What would you think of also exposing something likecache.entries()
that gives you the list of keys, when they were last updated, and when they expire?The text was updated successfully, but these errors were encountered: