cachestore

package
v0.12.3 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Overview

Package cachestore implements a blob.Store that wraps the keyspaces of an underlying store in memory caches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV added in v0.7.0

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

KV implements a blob.KV that delegates to an underlying store through an in-memory cache. This is appropriate for a high-latency or quota-limited remote store (such as a GCS or S3 bucket) that will not be concurrently written by other processes; concurrent readers are fine.

Both reads and writes are cached, and the store writes through to the underlying store. Negative hits from Get and Size are also cached.

func NewKV added in v0.9.0

func NewKV(s blob.KV, maxBytes int) *KV

NewKV constructs a new cached KV with the specified capacity in bytes, delegating storage operations to s. It will panic if maxBytes < 0.

func (*KV) Delete added in v0.7.0

func (s *KV) Delete(ctx context.Context, key string) error

Delete implements a method of blob.KV.

func (*KV) Get added in v0.7.0

func (s *KV) Get(ctx context.Context, key string) ([]byte, error)

Get implements a method of blob.KV.

func (*KV) Has added in v0.11.0

func (s *KV) Has(ctx context.Context, keys ...string) (blob.KeySet, error)

Has implements a method of blob.KV.

func (*KV) Len added in v0.7.0

func (s *KV) Len(ctx context.Context) (int64, error)

Len implements a method of blob.KV.

func (*KV) List added in v0.7.0

func (s *KV) List(ctx context.Context, start string) iter.Seq2[string, error]

List implements a method of blob.KV.

func (*KV) Put added in v0.7.0

func (s *KV) Put(ctx context.Context, opts blob.PutOptions) error

Put implements a method of blob.KV.

type Store

type Store struct {
	*monitor.M[state, *KV]
}

Store implements the blob.StoreCloser interface.

func New

func New(base blob.Store, maxBytes int) Store

New constructs a new root Store delegated to base. It will panic if maxBytes < 0.

func (Store) Close

func (s Store) Close(ctx context.Context) error

Close implements a method of the blob.StoreCloser interface.

Jump to

Keyboard shortcuts

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