Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cacher ¶
type Cacher interface {
// Has determines if an entry exists in the cache.
Has(key string) (bool, error)
// Get retrieves an entry from the cache for the given key.
Get(key string) ([]byte, error)
// GetWithDefault retrieves an entry from the cache for the
// given key. Returns default value if value is not found.
GetWithDefault(key string, defaultValue []byte) ([]byte, error)
// Many retrieves multiple db from the cache by key.
// Items not found in the cache will have a empty string.
Many(keys []string) ([][]byte, error)
// Set stores an entry in the cache for a given number of ttl.
Set(key string, value []byte, ttl time.Duration) error
// Pull retrieves an entry from the cache and removes it in the cache.
Pull(key string) ([]byte, error)
// PullWithDefault retrieves an entry from the cache and removes it in
// the cache. Returns default value if value is not found.
PullWithDefault(key string, defaultValue []byte) ([]byte, error)
// Forever stores an entry in the cache indefinitely.
Forever(key string, value []byte) error
// Remember gets an entry from the cache, or stores an entry from
// the closure in the cache for a given number of ttl.
Remember(key string, ttl time.Duration, valueFunc func() ([]byte, error)) ([]byte, error)
// RememberForever gets an entry from the cache, or stores an entry
// from the closure in the cache forever.
RememberForever(key string, valueFunc func() ([]byte, error)) ([]byte, error)
// Delete removes an entry from the cache.
Delete(key string) error
// Reset removes all data from the cache.
Reset() error
// Close closes the cache
Close() error
// contains filtered or unexported methods
}
Cacher interface defines cache behaviors.
type Cmdable ¶
type Cmdable interface {
Del(ctx context.Context, keys ...string) *redis.IntCmd
Exists(ctx context.Context, keys ...string) *redis.IntCmd
Get(ctx context.Context, key string) *redis.StringCmd
MGet(ctx context.Context, keys ...string) *redis.SliceCmd
Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *redis.StatusCmd
Scan(ctx context.Context, cursor uint64, match string, count int64) *redis.ScanCmd
}
Cmdable is a subset of go-redis Cmdable
Click to show internal directories.
Click to hide internal directories.