cache

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache added in v0.1.8

type Cache interface {
	Get(key interface{}) (interface{}, bool)
	SetWithTTL(key, value interface{}, cost int64, ttl time.Duration) bool
	Del(key interface{})
	Clear()
}

Cache represents caching functionality. Concrete implementation is expected to be thread-safe.

type Provider

type Provider struct {
	Cache Cache
}

Provider provides the underlying StorageProvider with caching support.

func (*Provider) Wrap added in v0.1.8

func (p *Provider) Wrap(storageProvider StorageProvider, opts ...WrapOption) storage.Provider

Wrap adds caching support to the underlying StorageProvider.

type StorageProvider added in v0.1.8

type StorageProvider = storage.Provider

StorageProvider is an alias for storage.Provider.

type Store added in v0.1.8

type Store = storage.Store

Store is an alias for storage.Store.

type WrapOption added in v0.1.8

type WrapOption func(p *wrapOptions)

WrapOption configures wrapped provider.

func WithCacheTTL added in v0.1.8

func WithCacheTTL(ttl time.Duration) WrapOption

WithCacheTTL sets the TTL (time to live) for cache items.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL