cache.go 389 B

12345678910111213141516171819
  1. package localcache
  2. import (
  3. "time"
  4. gocache "github.com/patrickmn/go-cache"
  5. )
  6. // CacheService cache any object in memory on the local instance.
  7. type CacheService struct {
  8. *gocache.Cache
  9. }
  10. // New returns a new CacheService
  11. func New(defaultExpiration, cleanupInterval time.Duration) *CacheService {
  12. return &CacheService{
  13. Cache: gocache.New(defaultExpiration, cleanupInterval),
  14. }
  15. }