Documentation ¶
Index ¶
- Constants
- type RistrettoClientInterface
- type RistrettoStore
- func (s *RistrettoStore) Clear(_ context.Context) error
- func (s *RistrettoStore) Del(_ context.Context, key any) error
- func (s *RistrettoStore) Get(_ context.Context, key any) (any, error)
- func (s *RistrettoStore) GetWithTTL(ctx context.Context, key any) (any, time.Duration, error)
- func (s *RistrettoStore) Set(_ context.Context, key any, value any) error
- func (s *RistrettoStore) SetWithTTL(ctx context.Context, key any, value any, ttl time.Duration) error
- func (s *RistrettoStore) Wait(_ context.Context)
Constants ¶
View Source
const ( // RistrettoType represents the storage type as a string value. RistrettoType = "ristretto" // RistrettoTagPattern represents the tag pattern to be used as a key in specified storage. RistrettoTagPattern = "gocache_tag_%s" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RistrettoClientInterface ¶
type RistrettoClientInterface interface { Get(key any) (any, bool) Set(key, value any, cost int64) bool SetWithTTL(key, value any, cost int64, ttl time.Duration) bool Del(key any) Clear() Wait() }
RistrettoClientInterface represents a dgraph-io/ristretto client.
type RistrettoStore ¶
type RistrettoStore struct {
// contains filtered or unexported fields
}
RistrettoStore is a store for Ristretto (memory) library.
func NewRistretto ¶
func NewRistretto(client RistrettoClientInterface) *RistrettoStore
NewRistretto creates a new store to Ristretto (memory) library instance.
func (*RistrettoStore) Clear ¶
func (s *RistrettoStore) Clear(_ context.Context) error
Clear resets all data in the store.
func (*RistrettoStore) Del ¶
func (s *RistrettoStore) Del(_ context.Context, key any) error
Delete removes data in Ristretto memory cache for given key identifier.
func (*RistrettoStore) GetWithTTL ¶
GetWithTTL returns data stored from a given key and its corresponding TTL.
func (*RistrettoStore) SetWithTTL ¶
func (*RistrettoStore) Wait ¶
func (s *RistrettoStore) Wait(_ context.Context)
Click to show internal directories.
Click to hide internal directories.