Documentation ¶
Index ¶
- Variables
- type Cache
- type ErrCacheKeyNotFound
- type MemoryCache
- func (mc *MemoryCache) Clear(ctx context.Context) error
- func (mc *MemoryCache) DeleteMulti(ctx context.Context, keys []string) error
- func (mc *MemoryCache) GetMulti(ctx context.Context, keys []string, dst interface{}) error
- func (mc *MemoryCache) SetMulti(ctx context.Context, keys []string, values interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidDstType is an error returned when dst type doesn't match with the stored one. ErrInvalidDstType = errors.New("datastore: dst has invalid type") // ErrInvalidDstLength is an error returned when dst type doesn't match with the stored one. ErrInvalidDstLength = errors.New("datastore: key and dst slices have different length") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { SetMulti(ctx context.Context, keys []string, values interface{}) error GetMulti(ctx context.Context, keys []string, dst interface{}) error DeleteMulti(ctx context.Context, keys []string) error Clear(ctx context.Context) error }
Cache interface for the client to use before accessing the datastore
type ErrCacheKeyNotFound ¶
type ErrCacheKeyNotFound string
ErrCacheKeyNotFound is an error alias
func (ErrCacheKeyNotFound) Error ¶
func (e ErrCacheKeyNotFound) Error() string
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache is an example type that implements Cache in a single process environment.
func (*MemoryCache) Clear ¶
func (mc *MemoryCache) Clear(ctx context.Context) error
Clear clears the cache
func (*MemoryCache) DeleteMulti ¶
func (mc *MemoryCache) DeleteMulti(ctx context.Context, keys []string) error
DeleteMulti implements Cache#DeleteMulti
Click to show internal directories.
Click to hide internal directories.