go icon indicating copy to clipboard operation
go copied to clipboard

Create cache.Interface implementations for popular cache engines

Open przmv opened this issue 6 years ago • 5 comments

go-ipinfo provides the ability to use caching using cache.Interface and custom implementations. However it would be convenient to provide custom implementations for some popular cache engines:

  • [x] go-cache
  • [ ] boltdb
  • [ ] redis
  • [ ] memcached

przmv avatar Jun 03 '19 21:06 przmv

Is boltdb (now forked into bbolt) really used a cache engine? AFAIK it's writing to disk and don't think people would use it for this, so might not be worth the effort.

If anything, memcached should replace that on the list instead.

UmanShahzad avatar Oct 23 '20 09:10 UmanShahzad

@UmanShahzad it depends on a use case. For web apps some in-memory cache would be an ideal solution, but not for CLI apps.

przmv avatar Oct 26 '20 14:10 przmv

@pshevtsov I would think it's the other way around - CLI apps can play fast and loose with memory because they'll usually terminate before memory is an issue, and some web apps might want a really large cache so would do it on-disk to be safe from exhausting mem.

In any case, I agree that at least Redis/Memcached should be supported. Supporting bbolt sounds fine too but would put it last on the prio list.

UmanShahzad avatar Oct 26 '20 15:10 UmanShahzad

Actually I correct myself, @pshevtsov - I see that if we created our own CLI having an on-disk cache with TTLs would be great to answer requests across multiple CLI calls.

I'll contribute something for that fairly soon, since that use case has come up.

UmanShahzad avatar Oct 27 '20 01:10 UmanShahzad

Feel free to contact me directly, since I’ve already implemented a CLI app, that uses IPinfo API client and boltdb as a cache. It is used in production and is heavily tested.

Petr Shevtsov

On 27 Oct 2020, at 04:05, Uman Shahzad [email protected] wrote:

 Actually I correct myself, @pshevtsov - I see that if we created our own CLI having an on-disk cache with TTLs would be great to answer requests across multiple CLI calls.

I'll contribute something for that fairly soon, since that use case has come up.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

przmv avatar Oct 27 '20 04:10 przmv