Documentation
¶
Index ¶
- type Codec
- func (c *Codec) Clear(ctx context.Context) error
- func (c *Codec) Delete(ctx context.Context, key any) error
- func (c *Codec) Get(ctx context.Context, key any) (any, error)
- func (c *Codec) GetStats() *Stats
- func (c *Codec) GetStore() store.StoreInterface
- func (c *Codec) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)
- func (c *Codec) Invalidate(ctx context.Context, options ...store.InvalidateOption) error
- func (c *Codec) Set(ctx context.Context, key any, value any, options ...store.Option) error
- func (c *Codec) SetIfNotExists(ctx context.Context, key any, value any, options ...store.Option) (bool, error)
- type CodecInterface
- type Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec represents an instance of a cache store
func (*Codec) GetStore ¶
func (c *Codec) GetStore() store.StoreInterface
GetStore returns the store associated to this codec
func (*Codec) GetWithTTL ¶
GetWithTTL allows to retrieve the value from a given key identifier and its corresponding TTL
func (*Codec) Invalidate ¶
Invalidate invalidates some cache items from given options
func (*Codec) Set ¶
Set allows to set a value for a given key identifier and also allows to specify an expiration time
func (*Codec) SetIfNotExists ¶ added in v4.3.0
func (c *Codec) SetIfNotExists(ctx context.Context, key any, value any, options ...store.Option) (bool, error)
SetIfNotExists sets a value for a given key identifier only when it does not already exist. It returns store.ErrNotSupported when the underlying store has no atomic primitive to do so.
type CodecInterface ¶
type CodecInterface interface {
Get(ctx context.Context, key any) (any, error)
GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)
Set(ctx context.Context, key any, value any, options ...store.Option) error
Delete(ctx context.Context, key any) error
Invalidate(ctx context.Context, options ...store.InvalidateOption) error
Clear(ctx context.Context) error
GetStore() store.StoreInterface
GetStats() *Stats
}
CodecInterface represents an instance of a cache codec
Click to show internal directories.
Click to hide internal directories.