cache

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProvidersName = "caches"
)

Variables

View Source
var (
	ErrEmptyCachees            = errors.New("empty caches")
	ErrConnectionPointerIsNil  = errors.New("nil passed as connection pointer")
	ErrConnectionDoesNotExists = errors.New("connection does not exist")
	ErrMutexPointerIsNil       = errors.New("nil passed as mutex pointer")
	ErrNotLockIDPointer        = errors.New("passed lockID is not int64")
	ErrDBConnNotEstablished    = errors.New("cache connection not established")
	ErrNotFoundInCache         = errors.New("not found in cache")
	ErrNotLockKey              = errors.New("passed lockID is not string")
)

Functions

func ErrNotConfigPointer added in v0.3.0

func ErrNotConfigPointer(iface interface{}) error

func ErrNotConnectionPointer

func ErrNotConnectionPointer(iface interface{}) error

func ErrNotMigrationPointer

func ErrNotMigrationPointer(iface interface{}) error

func ErrNotMutexPointer

func ErrNotMutexPointer(iface interface{}) error

func ErrNotQueueItemPointer

func ErrNotQueueItemPointer(iface interface{}) error

func GetEnity

func GetEnity(ctx context.Context, provider, enityName string) (interface{}, error)

func Registrate

func Registrate(ctx context.Context) context.Context

func RegistrateEnity

func RegistrateEnity(ctx context.Context, provider, enityName string, options interface{}) (context.Context, error)

func RegistrateProvider

func RegistrateProvider(ctx context.Context, name string, p Provider) (context.Context, error)

Types

type Caches

Caches is a controlling structure for all caches and providers.

func Get

func Get(ctx context.Context) *Caches

func NewCaches

func NewCaches(ctx context.Context) *Caches

func (*Caches) GetAllAliveHandlers

func (c *Caches) GetAllAliveHandlers(out stats.MapCheckFunc) (stats.MapCheckFunc, error)

GetAllAliveHandlers collect all aliveHandlers for Databases

func (*Caches) GetAllMetrics

func (c *Caches) GetAllMetrics(out stats.MapMetricsOptions) (stats.MapMetricsOptions, error)

GetAllMetrics collect all metrics for Databases

func (*Caches) GetAllReadyHandlers

func (c *Caches) GetAllReadyHandlers(out stats.MapCheckFunc) (stats.MapCheckFunc, error)

GetAllReadyHandlers collect all readyHandlers for Databases

func (*Caches) GetProvider

func (c *Caches) GetProvider(providerName string) (Provider, error)

GetProvider returns requested caches provider. It'll return error if providers wasn't registered.

type Provider

type Provider interface {
	provider.IProvider
	provider.IEnityManager
	stats.IProviderMetrics

	// Get item from cache by key.
	Get(connectionName, key string, value interface{}) error
	// Set item in cache by key.
	Set(connectionName, key string, value interface{}) error
	// SetNX (Not eXist) item in cache by key.
	SetNX(connectionName, key string, value interface{}) error
	// Delete item from cache by key.
	Delete(connectionName, key string) error
	// Clear all items from selected connection.
	Clear(connectionName string) error
	// Clear all items from all connections.
	ClearAll() error
}

Provider is an interface every cache provider should conform. Every provider can hold more than one connection.

func GetProvider

func GetProvider(ctx context.Context, name string) (Provider, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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