Documentation
¶
Index ¶
- Variables
- type Cache
- func (c *Cache) Forget(ctx context.Context, key string) error
- func (c *Cache) GetString(ctx context.Context, key string) (string, error)
- func (c *Cache) GetStruct(ctx context.Context, key string, data any) error
- func (c *Cache) PutString(ctx context.Context, key string, data string, ttl time.Duration) error
- func (c *Cache) PutStruct(ctx context.Context, key string, data any, ttl time.Duration) error
- func (c *Cache) RememberString(ctx context.Context, key string, ttl time.Duration, f CacheStringFunc) (string, error)
- func (c *Cache) RememberStruct(ctx context.Context, key string, data any, ttl time.Duration, ...) error
- type CacheStringFunc
- type CacheStructFunc
- type MemoryStore
- func (m *MemoryStore) Forget(ctx context.Context, key string) error
- func (m *MemoryStore) GetString(ctx context.Context, key string) (string, error)
- func (m *MemoryStore) GetStruct(ctx context.Context, key string, data any) error
- func (m *MemoryStore) PutString(ctx context.Context, key string, data string, ttl time.Duration) error
- func (m *MemoryStore) PutStruct(ctx context.Context, key string, data any, ttl time.Duration) error
- type RedisStore
- func (r *RedisStore) Forget(ctx context.Context, key string) error
- func (r *RedisStore) GetString(ctx context.Context, key string) (string, error)
- func (r *RedisStore) GetStruct(ctx context.Context, key string, data any) error
- func (r *RedisStore) PutString(ctx context.Context, key string, data string, ttl time.Duration) error
- func (r *RedisStore) PutStruct(ctx context.Context, key string, data any, ttl time.Duration) error
- type RueidisStore
- func (r *RueidisStore) Forget(ctx context.Context, key string) error
- func (r *RueidisStore) GetString(ctx context.Context, key string) (string, error)
- func (r *RueidisStore) GetStruct(ctx context.Context, key string, data any) error
- func (r *RueidisStore) PutString(ctx context.Context, key string, data string, ttl time.Duration) error
- func (r *RueidisStore) PutStruct(ctx context.Context, key string, data any, ttl time.Duration) error
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMissingKey = errors.New("key not found")
)
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) RememberString ¶
type CacheStringFunc ¶
type CacheStructFunc ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
func NewRedisStore ¶
func NewRedisStore(client *redis.Client) *RedisStore
type RueidisStore ¶ added in v1.1.0
type RueidisStore struct {
// contains filtered or unexported fields
}
func NewRueidisStore ¶ added in v1.1.0
func NewRueidisStore(c rueidis.Client) *RueidisStore
func (*RueidisStore) Forget ¶ added in v1.1.0
func (r *RueidisStore) Forget(ctx context.Context, key string) error
type Store ¶
type Store interface {
GetString(ctx context.Context, key string) (string, error)
PutString(ctx context.Context, key string, data string, ttl time.Duration) error
GetStruct(ctx context.Context, key string, data any) error
PutStruct(ctx context.Context, key string, data any, ttl time.Duration) error
Forget(ctx context.Context, key string) error
}
Click to show internal directories.
Click to hide internal directories.