ristretto

package module
v0.0.0-...-e3220b9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ristretto provides a cache service using in-memory implementation of dgraph-io/ristretto.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cacher

type Cacher[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Cacher is an in-memory cache implementation using dgraph-io/ristretto cache.

func New

func New[K comparable, V any](conf *Config) *Cacher[K, V]

func (*Cacher[K, V]) Close

func (c *Cacher[K, V]) Close(ctx context.Context) error

Close close the underlying connection.

func (*Cacher[K, V]) Delete

func (c *Cacher[K, V]) Delete(ctx context.Context, k K) error

Delete a value

func (*Cacher[K, V]) Get

func (c *Cacher[K, V]) Get(ctx context.Context, k K) (rs V, err error)

Get a value, return ErrNotFound if key not found.

func (*Cacher[K, V]) Open

func (c *Cacher[K, V]) Open(ctx context.Context) error

Open establish connection to the target server.

func (*Cacher[K, V]) Set

func (c *Cacher[K, V]) Set(ctx context.Context, k K, v V, opts ...cache.SetOption) error

Set a value

type Config

type Config = ristretto.Config

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL