Versions in this module Expand all Collapse all v1 v1.0.10 Nov 9, 2022 v1.0.9 May 24, 2022 v1.0.8 Jan 25, 2022 v1.0.7 Nov 19, 2021 v1.0.6 Jun 30, 2021 v1.0.5 Mar 8, 2021 v1.0.4 Nov 19, 2019 v1.0.3 Nov 7, 2019 v1.0.2 Nov 7, 2019 v1.0.1 Jul 31, 2019 v1.0.0 Jul 29, 2019 Changes in this version + const MaxSize + var ErrBlobExists = errors.New("blob already exists") + var ErrBlobNotFound = errors.New("blob not found") + var ErrBlobTooBig = errors.New("blob size exceeded") + var ErrShuttingDown = errors.New("server is shutting down") + var ErrTestIntentional = fmt.Errorf("intentional failure for test") + var TestAlwaysFail = func(set, key string) error + var WithLazySaveOption = LazySaveOption + var WithRetryOpt = RetryOpt + func TestFailAfterN(n int) func(set, key string) error + func TestFailPct(n uint32, seed int64) func(set, key string) error + type LazySaveOption struct + func (l LazySaveOption) Items(limit, flushAt int) lazySaveOption + func (l LazySaveOption) Logger(logger log.Adapter) lazySaveOption + func (l LazySaveOption) MaxTime(n time.Duration) lazySaveOption + func (l LazySaveOption) SaveTimeout(n time.Duration) lazySaveOption + func (l LazySaveOption) Savers(n int) lazySaveOption + func (l LazySaveOption) Verbose(b bool) lazySaveOption + type LazySaver struct + func NewLazySaver(store Store, opts ...lazySaveOption) (*LazySaver, error) + func (l *LazySaver) Delete(ctx context.Context, set, key string) error + func (l *LazySaver) Get(ctx context.Context, set, key string) ([]byte, error) + func (l *LazySaver) Set(ctx context.Context, set, key string, b []byte) error + func (l *LazySaver) Shutdown() + func (l *LazySaver) Stats() LazyStats + type LazyStats struct + Deletes int + GetBytes int64 + GetSavedBytesPct float64 + Gets int + ItemBytes int64 + ItemQueue int + LoadedBytes int64 + Options struct{ ... } + OutDeletes int + OutGetBytes int64 + OutGets int + OutSetBytes int64 + OutSets int + SavedBytes int64 + SetBytes int64 + SetSavedBytesPct float64 + Sets int + type MaxSizeStore struct + func NewMaxSizeStore(store Store, maxSize int) (*MaxSizeStore, error) + func (r *MaxSizeStore) Delete(ctx context.Context, set, key string) error + func (r *MaxSizeStore) Get(ctx context.Context, set, key string) ([]byte, error) + func (r *MaxSizeStore) Set(ctx context.Context, set, key string, b []byte) error + type RetryOpt struct + func (l RetryOpt) Backoff(get, set, del func() backoff.BackOff) RetryStoreOption + func (l RetryOpt) OpTimeout(duration time.Duration) RetryStoreOption + func (l RetryOpt) PermanentErr(errs ...error) RetryStoreOption + type RetryStore struct + func NewRetryStore(store Store, opts ...RetryStoreOption) (*RetryStore, error) + func (r *RetryStore) Delete(ctx context.Context, set, key string) error + func (r *RetryStore) Get(ctx context.Context, set, key string) ([]byte, error) + func (r *RetryStore) Set(ctx context.Context, set, key string, b []byte) error + type RetryStoreOption func(*retryStoreOptions) error + type Store interface + Delete func(ctx context.Context, set, key string) error + Get func(ctx context.Context, set, key string) ([]byte, error) + Set func(ctx context.Context, set, key string, val []byte) error + type TestStorage struct + DeleteCallback func(set, key string) + GetCallback func(set, key string) + SetCallback func(set, key string, b []byte) + func NewTestStore(store Store) *TestStorage + func (t *TestStorage) Delete(ctx context.Context, set, key string) error + func (t *TestStorage) FailDelete(check func(set, key string) error) + func (t *TestStorage) FailGet(check func(set, key string) error) + func (t *TestStorage) FailSet(check func(set, key string) error) + func (t *TestStorage) Get(ctx context.Context, set, key string) ([]byte, error) + func (t *TestStorage) Set(ctx context.Context, set, key string, b []byte) error + type WithSet interface + Delete func(ctx context.Context, key string) error + Get func(ctx context.Context, key string) ([]byte, error) + Set func(ctx context.Context, key string, val []byte) error + Store func() Store + func StoreWithSet(s Store, set string) WithSet