cacheopt.go 352 B

123456789101112131415161718192021
  1. package cache
  2. import (
  3. "time"
  4. "github.com/tal-tech/go-zero/core/stores/internal"
  5. )
  6. type Option = internal.Option
  7. func WithExpiry(expiry time.Duration) Option {
  8. return func(o *internal.Options) {
  9. o.Expiry = expiry
  10. }
  11. }
  12. func WithNotFoundExpiry(expiry time.Duration) Option {
  13. return func(o *internal.Options) {
  14. o.NotFoundExpiry = expiry
  15. }
  16. }