cache.go 337 B

12345678910111213141516171819202122
  1. package go_cache
  2. import (
  3. "time"
  4. "github.com/patrickmn/go-cache"
  5. )
  6. const (
  7. DefaultExpiration time.Duration = 5 * time.Minute
  8. CleanupInterval time.Duration = 10 * time.Minute
  9. )
  10. type GoCache struct {
  11. Cache *cache.Cache
  12. }
  13. func NewCache() *GoCache {
  14. return &GoCache{
  15. Cache: cache.New(DefaultExpiration, CleanupInterval),
  16. }
  17. }