cache

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: ISC Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ICacheCache

type ICacheCache interface {
	Get(key string) (*Item, bool)
	Replace(key string, value *Item, d time.Duration) error
	ReplaceIfExists(key string, value *Item, d time.Duration) error
	Delete(key string)
	Add(key string, value *Item, d time.Duration) error

	IsEnabled() bool
	IsDisabled() bool

	Flush()
	Start()
	Shutdown()
}

func NewCacheMemory

func NewCacheMemory(cacheConfig *MemoryConfigInput) ICacheCache

type Item

type Item struct {
	Item interface{}
	Code string
}

type Memory

type Memory struct {
	Cleanup    int
	Expiration int
	// contains filtered or unexported fields
}

func (*Memory) Add

func (c *Memory) Add(key string, value *Item, d time.Duration) error

func (*Memory) Delete

func (c *Memory) Delete(key string)

func (*Memory) Flush

func (c *Memory) Flush()

func (*Memory) Get

func (c *Memory) Get(key string) (*Item, bool)

func (*Memory) IsDisabled

func (c *Memory) IsDisabled() bool

func (*Memory) IsEnabled

func (c *Memory) IsEnabled() bool

func (*Memory) Replace

func (c *Memory) Replace(key string, value *Item, d time.Duration) error

func (*Memory) ReplaceIfExists

func (c *Memory) ReplaceIfExists(key string, value *Item, d time.Duration) error

func (*Memory) Shutdown

func (c *Memory) Shutdown()

func (*Memory) Start

func (c *Memory) Start()

type MemoryConfigInput

type MemoryConfigInput struct {
	Expiration int
	Cleanup    int
	Logger     *logrus.Entry
}

Jump to

Keyboard shortcuts

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