Documentation
¶
Index ¶
- Variables
- type Store
- func (s *Store) Close() error
- func (s *Store) GetMeta(ctx context.Context, primaryKey string) (*pb.CacheMetadata, bool, error)
- func (s *Store) GetVariant(ctx context.Context, primaryKey, variantKey string) (*pb.VariantInfo, []byte, error)
- func (s *Store) Purge(ctx context.Context, primaryKey string, soft bool) (int64, error)
- func (s *Store) PurgeAll(ctx context.Context) (int64, error)
- func (s *Store) PurgeByPattern(ctx context.Context, pattern string, soft bool) (int64, error)
- func (s *Store) PurgeByTag(ctx context.Context, tag string, soft bool) (int64, error)
- func (s *Store) Reset()
- func (s *Store) SetClosed(closed bool)
- func (s *Store) SetGetMetaHook(...)
- func (s *Store) SetGetVariantHook(...)
- func (s *Store) SetPurgeByTagHook(fn func(ctx context.Context, tag string, soft bool) (int64, error))
- func (s *Store) SetPurgeHook(fn func(ctx context.Context, primaryKey string, soft bool) (int64, error))
- func (s *Store) SetSetVariantHook(...)
- func (s *Store) SetVariant(ctx context.Context, primaryKey string, meta *pb.CacheMetadata, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrClosed is returned when operations are attempted on a closed Store. ErrClosed = errors.New("teststore: store is closed") )
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a thread-safe, in-memory implementation of storage.Storage designed for unit testing.
func (*Store) GetMeta ¶
GetMeta retrieves the primary index, Vary headers, and soft-purged operational status.
func (*Store) GetVariant ¶
func (s *Store) GetVariant(ctx context.Context, primaryKey, variantKey string) (*pb.VariantInfo, []byte, error)
GetVariant retrieves a specific variant metadata and its body payload.
func (*Store) PurgeByPattern ¶
PurgeByPattern invalidates all keys matching the given glob pattern within the storage.
func (*Store) PurgeByTag ¶
PurgeByTag invalidates all primary metadata matching a given tag.
func (*Store) SetGetMetaHook ¶
func (s *Store) SetGetMetaHook(fn func(ctx context.Context, primaryKey string) (*pb.CacheMetadata, bool, error))
SetGetMetaHook sets a custom hook for GetMeta operations.
func (*Store) SetGetVariantHook ¶
func (s *Store) SetGetVariantHook(fn func(ctx context.Context, primaryKey, variantKey string) (*pb.VariantInfo, []byte, error))
SetGetVariantHook sets a custom hook for GetVariant operations.
func (*Store) SetPurgeByTagHook ¶
func (s *Store) SetPurgeByTagHook(fn func(ctx context.Context, tag string, soft bool) (int64, error))
SetPurgeByTagHook sets a custom hook for PurgeByTag operations.
func (*Store) SetPurgeHook ¶
func (s *Store) SetPurgeHook(fn func(ctx context.Context, primaryKey string, soft bool) (int64, error))
SetPurgeHook sets a custom hook for Purge operations.
func (*Store) SetSetVariantHook ¶
func (s *Store) SetSetVariantHook(fn func(ctx context.Context, primaryKey string, meta *pb.CacheMetadata, variant *pb.VariantInfo, body []byte, ttl time.Duration) error)
SetSetVariantHook sets a custom hook for SetVariant operations.
func (*Store) SetVariant ¶
func (s *Store) SetVariant(ctx context.Context, primaryKey string, meta *pb.CacheMetadata, variant *pb.VariantInfo, body []byte, ttl time.Duration) error
SetVariant atomically records a new or updated variant and its body payload.