Documentation
¶
Index ¶
Constants ¶
View Source
const ( NoExpiration = gocache.NoExpiration DefaultExpiration = gocache.DefaultExpiration )
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrRead = errors.New("could not read value at cache key") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get gets the cache value as an byte array
Get(ctx context.Context, key string) ([]byte, error)
// Set saves the value as an byte array. if `expire` is set to zero it will use the cache default expiration time.
Set(ctx context.Context, key string, value []byte, expire time.Duration) error
// Delete object from cache
Delete(ctx context.Context, key string) error
}
Cache allows the caller to set, get and delete items in the cache.
type LocalCache ¶
type LocalCache struct {
// contains filtered or unexported fields
}
func NewLocalCache ¶
func NewLocalCache(cfg Config) *LocalCache
Click to show internal directories.
Click to hide internal directories.