cachedrepository

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New returns a new initialized CachedRepository instance.

Types

type Cache

type Cache interface {
	// Type identifies underlying cache store type.
	Type() string

	// Get retrieves k value from the cache store.
	// If not present nil will be returned.
	Get(ctx context.Context, ns, key string) ([]byte, error)

	// Put stores a value into the cache store.
	Put(ctx context.Context, ns, key string, val []byte) error

	// Del removes keys values from the cache store.
	Del(ctx context.Context, ns string, keys ...string) error

	// DelNS removes all keys contained under a given namespace from the cache store.
	DelNS(ctx context.Context, ns string) error

	// HasKey tells whether k is present in the cache store.
	HasKey(ctx context.Context, ns, key string) (bool, error)

	// Start starts Cache component.
	Start(ctx context.Context) error

	// Stop stops Cache component.
	Stop(ctx context.Context) error
}

Cache defines cache store interface.

type CachedRepository

CachedRepository is cached Repository implementation.

func (*CachedRepository) InTransaction

func (c *CachedRepository) InTransaction(ctx context.Context, f func(ctx context.Context, tx repository.Transaction) error) error

InTransaction generates a repository transaction and completes it after it's being used by f function. In case f returns no error tx transaction will be committed.

func (*CachedRepository) Start

func (c *CachedRepository) Start(ctx context.Context) error

Start starts cached repository component.

func (*CachedRepository) Stop

func (c *CachedRepository) Stop(ctx context.Context) error

Stop stops cached repository component.

type Config

type Config struct {
	Type  string
	Redis rediscache.Config
}

Config contains cached repository configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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