cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service interface {
	//Put write key to cache
	Put(ctx context.Context, key string, data []byte, ttl time.Duration) error
	//Get cache value
	Get(ctx context.Context, key string) ([]byte, error)
	//Remove cache for supplied key
	Delete(ctx context.Context, key string) error
}

Service represents generic cache service

type ServiceRegistry

type ServiceRegistry interface {
	//Register registers service
	Register(name string, service Service)
	//Get returns service
	Get(name string) (Service, error)
	//Remove removes service
	Remove(name string)
	//Returns register cache services
	Keys() []string
}

ServiceRegistry represents cache registry

func New

func New() ServiceRegistry

New creates a registry

func Registry

func Registry() ServiceRegistry

Data returns cache registry singleton

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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