dnscache icon indicating copy to clipboard operation
dnscache copied to clipboard

Allow to filter which entries to cache

Open dcolens opened this issue 9 years ago • 2 comments

I'm looking for a way to only cache names for a given domain. So I'm thinking having a filter option that takes a regular expression for example, if one wants to cache only hostnames with the example.org domain :

{ filter: /example.org$/ }

Would you take a pull request that implements this ? (Or do you have another suggestion to do the same ?)

dcolens avatar Nov 03 '16 09:11 dcolens

(Oy, sorry for taking so long to respond.)

Yes, pull requests are most appreciated. A filter configuration sounds like a great way to do this. Hmm... perhaps call it cacheOnly so that it's a bit more self-documenting.

drewfish avatar Nov 22 '16 22:11 drewfish

It would make sense to implement it in the cache module, so that cache.set checks if the key matches the filter. But it would not play well with the reverse method :/

Could also write a wrapper around cache.set and call it for all methods but reverse ? Thoughts ?

dcolens avatar Feb 15 '17 12:02 dcolens