Documentation ¶
Index ¶
- Variables
- type Cache
- type MemLruCache
- func (m *MemLruCache) Delete(_ context.Context, key string) (bool, error)
- func (m *MemLruCache) Exist(_ context.Context, key string) (bool, error)
- func (m *MemLruCache) Get(_ context.Context, key string) (interface{}, error)
- func (m *MemLruCache) Set(ctx context.Context, key string, value interface{}) error
- func (m *MemLruCache) SetEx(ctx context.Context, key string, value interface{}, expire time.Duration) error
- type RedisCache
- func (s RedisCache) Delete(ctx context.Context, key string) (bool, error)
- func (s RedisCache) Exist(ctx context.Context, key string) (bool, error)
- func (s RedisCache) Get(ctx context.Context, key string) (interface{}, error)
- func (s RedisCache) Set(ctx context.Context, key string, value interface{}) error
- func (s RedisCache) SetEx(ctx context.Context, key string, value interface{}, expire time.Duration) error
- type SingleFlightCache
- func (s *SingleFlightCache) Delete(_ context.Context, _ string) (bool, error)
- func (s *SingleFlightCache) Exist(_ context.Context, _ string) (bool, error)
- func (s *SingleFlightCache) Get(ctx context.Context, _ string) (interface{}, error)
- func (s *SingleFlightCache) Set(_ context.Context, _ string, value interface{}) error
- func (s *SingleFlightCache) SetEx(_ context.Context, _ string, value interface{}, expire time.Duration) error
- type SingleFlightFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorValueExpired = errors.New("cached value expired")
View Source
var ErrorValueExpiredOrNotExist = errors.New("cached value expired or not exist")
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(ctx context.Context, key string) (interface{}, error) Set(ctx context.Context, key string, value interface{}) error SetEx(ctx context.Context, key string, value interface{}, expire time.Duration) error Delete(ctx context.Context, key string) (bool, error) Exist(ctx context.Context, key string) (bool, error) }
func NewSingleFlightCache ¶
type MemLruCache ¶
type MemLruCache struct {
// contains filtered or unexported fields
}
func (*MemLruCache) Get ¶
func (m *MemLruCache) Get(_ context.Context, key string) (interface{}, error)
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
func NewRedisCache ¶
func NewRedisCache(client *redis.Client) *RedisCache
func (RedisCache) Get ¶
func (s RedisCache) Get(ctx context.Context, key string) (interface{}, error)
type SingleFlightCache ¶
type SingleFlightCache struct {
// contains filtered or unexported fields
}
func (*SingleFlightCache) Get ¶
func (s *SingleFlightCache) Get(ctx context.Context, _ string) (interface{}, error)
type SingleFlightFunc ¶
Click to show internal directories.
Click to hide internal directories.