cache

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

type Creator func() GCache

Creator defines function to create a new GCache instance.

type GCache

type GCache interface {
	Get(key interface{}) (interface{}, error)
	SetWithExpire(key, value interface{}, expiration time.Duration) error
	Remove(key interface{}) bool
	Purge()
}

GCache represents GCache implementation.

type Option

type Option func(options *Options)

Option configures Options.

func WithExpiration

func WithExpiration(d time.Duration) Option

WithExpiration sets the custom cache expiration duration.

func WithGCacheCreator

func WithGCacheCreator(c Creator) Option

WithGCacheCreator sets the function to create a new GCache instance.

func WithLogger

func WithLogger(l log.Logger) Option

WithLogger sets the custom logger.

type Options

type Options struct {
	// contains filtered or unexported fields
}

Options configures Provider dependencies.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider contains dependencies for a storage provider based on GCache.

func NewProvider

func NewProvider(opts ...Option) *Provider

NewProvider returns a new storage provider instance based on GCache.

func (*Provider) Close

func (p *Provider) Close() error

Close purges all opened cache stores.

func (*Provider) GetOpenStores

func (p *Provider) GetOpenStores() []storage.Store

GetOpenStores is not implemented.

func (*Provider) GetStoreConfig

func (p *Provider) GetStoreConfig(name string) (storage.StoreConfiguration, error)

GetStoreConfig is not implemented.

func (*Provider) OpenStore

func (p *Provider) OpenStore(name string) (storage.Store, error)

OpenStore opens and returns a new cache store for the given namespace.

func (*Provider) SetStoreConfig

func (p *Provider) SetStoreConfig(name string, config storage.StoreConfiguration) error

SetStoreConfig is not implemented.

Jump to

Keyboard shortcuts

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