Help us shape the future of Go! Take the 2026 Go Developer Survey

jetstreamkv

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...cache.Option) (cache.RawCache, error)

New creates a new Valkey cache.

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a JetStream-backed cache implementation using the NATS KeyValue store.

func (*Cache) Close

func (vc *Cache) Close() error

Close closes the Valkey connection.

func (*Cache) Decrement

func (vc *Cache) Decrement(ctx context.Context, key string, delta int64) (int64, error)

Decrement atomically decrements a counter.

func (*Cache) Delete

func (vc *Cache) Delete(_ context.Context, key string) error

Delete removes an item from the cache.

func (*Cache) Exists

func (vc *Cache) Exists(_ context.Context, key string) (bool, error)

Exists checks if a key exists in the cache.

func (*Cache) Expire

func (vc *Cache) Expire(_ context.Context, _ string, _ time.Duration) error

Expire updates the TTL of an existing key. JetStream KV TTL is configured at bucket level, so per-key TTL changes are not supported.

func (*Cache) Flush

func (vc *Cache) Flush(_ context.Context) error

Flush clears all items from the cache.

func (*Cache) Get

func (vc *Cache) Get(_ context.Context, key string) ([]byte, bool, error)

Get retrieves an item from the cache.

func (*Cache) Increment

func (vc *Cache) Increment(_ context.Context, key string, delta int64) (int64, error)

Increment atomically increments a counter.

func (*Cache) Set

func (vc *Cache) Set(_ context.Context, key string, value []byte, _ time.Duration) error

Set sets an item in the cache with the specified TTL.

func (*Cache) SupportsPerKeyTTL

func (vc *Cache) SupportsPerKeyTTL() bool

Jump to

Keyboard shortcuts

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