Documentation
¶
Index ¶
- func BytesToHash(b ...[]byte) uint64
- func Handler(cacheSize int, ttl, errorTtl time.Duration, paths ...string) func(next http.Handler) http.Handler
- func HandlerWithKey(cacheSize int, ttl, errorTtl time.Duration, ...) func(next http.Handler) http.Handler
- func StringToHash(s ...string) uint64
- type Cache
- func (c *Cache[K]) Get(ctx context.Context, key K, fn singleflight.DoFunc[*responseValue]) (*responseValue, error)
- func (c *Cache[K]) GetFresh(ctx context.Context, key K, fn singleflight.DoFunc[*responseValue]) (*responseValue, error)
- func (c *Cache[K]) Set(ctx context.Context, key K, fn singleflight.DoFunc[*responseValue]) (*responseValue, bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToHash ¶
func HandlerWithKey ¶
func StringToHash ¶
Types ¶
type Cache ¶
type Cache[K comparable] struct { // contains filtered or unexported fields }
func NewCacheKV ¶
func NewCacheKV[K comparable](size int, ttl, errorTtl time.Duration) *Cache[K]
Click to show internal directories.
Click to hide internal directories.