Documentation
¶
Index ¶
- type BadgerConfig
- type Cache
- func InitCache(ctx context.Context) (Cache, func(), error)
- func NewBadgerCache(cfg BadgerConfig, opts ...Option) Cache
- func NewMemoryCache(cfg MemoryConfig, opts ...Option) Cache
- func NewRedisCache(cfg RedisConfig, opts ...Option) Cache
- func NewRedisCacheWithClient(cli *redis.Client, opts ...Option) Cache
- func NewRedisCacheWithClusterClient(cli *redis.ClusterClient, opts ...Option) Cache
- type MemoryConfig
- type Option
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadgerConfig ¶
type BadgerConfig struct {
Path string
}
type Cache ¶
type Cache interface { Set(ctx context.Context, ns, key, value string, expiration ...time.Duration) error Get(ctx context.Context, ns, key string) (string, bool, error) GetAndDelete(ctx context.Context, ns, key string) (string, bool, error) Exists(ctx context.Context, ns, key string) (bool, error) Delete(ctx context.Context, ns, key string) error Iterator(ctx context.Context, ns string, fn func(ctx context.Context, key, value string) bool) error Close(ctx context.Context) error }
func NewBadgerCache ¶
func NewBadgerCache(cfg BadgerConfig, opts ...Option) Cache
func NewMemoryCache ¶
func NewMemoryCache(cfg MemoryConfig, opts ...Option) Cache
func NewRedisCache ¶
func NewRedisCache(cfg RedisConfig, opts ...Option) Cache
func NewRedisCacheWithClient ¶
type MemoryConfig ¶
Click to show internal directories.
Click to hide internal directories.