Documentation ¶
Overview ¶
Package cachestore implements the blob.Store that delegates to an underlying store through an in-memory cache.
Index ¶
- type CAS
- type Store
- func (s *Store) Close(ctx context.Context) error
- func (s *Store) Delete(ctx context.Context, key string) error
- func (s *Store) Get(ctx context.Context, key string) ([]byte, error)
- func (s *Store) Len(ctx context.Context) (int64, error)
- func (s *Store) List(ctx context.Context, start string, f func(string) error) error
- func (s *Store) Put(ctx context.Context, opts blob.PutOptions) error
- func (s *Store) Size(ctx context.Context, key string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CAS ¶
type CAS struct { *Store // contains filtered or unexported fields }
CAS implements a cached wrapper around a blob.CAS instance.
func NewCAS ¶
NewCAS constructs a new cached store with the specified capacity in bytes, delegating storage operations to cas. It will panic if maxBytes < 0.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store implements a blob.Store 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 New ¶
New constructs a new cached store with the specified capacity in bytes, delegating storage operations to s. It will panic if maxBytes < 0.
func (*Store) Delete ¶
Delete implements a method of blob.Store. Although a successful Delete certifies the key does not exist, deletes are not cached as negative hits. This avoids cluttering the cache with keys for blobs whose content are not interesting enough to fetch.