cache

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultExpiration time.Duration = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type MemoryCache

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

func NewMemoryCache

func NewMemoryCache(defaultExpiration time.Duration, items map[string]MemoryCacheItem) *MemoryCache

func NewMemoryCacheWithCleaner

func NewMemoryCacheWithCleaner(defaultExpiration, cleanInterval time.Duration, items map[string]MemoryCacheItem) *MemoryCache

func (*MemoryCache) Delete

func (c *MemoryCache) Delete(keys ...string)

func (*MemoryCache) DeleteExpired

func (c *MemoryCache) DeleteExpired()

func (*MemoryCache) Flush

func (c *MemoryCache) Flush()

func (*MemoryCache) Get

func (c *MemoryCache) Get(key string) (interface{}, bool)

func (*MemoryCache) GetExpiration

func (c *MemoryCache) GetExpiration(key string) (interface{}, time.Time, bool)

func (*MemoryCache) Items

func (c *MemoryCache) Items() map[string]interface{}

func (*MemoryCache) Set

func (c *MemoryCache) Set(key string, value interface{}, expiration time.Duration)

func (*MemoryCache) SetDefault

func (c *MemoryCache) SetDefault(key string, value interface{})

func (*MemoryCache) Size

func (c *MemoryCache) Size() int

type MemoryCacheCleaner

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

type MemoryCacheItem

type MemoryCacheItem struct {
	Object     interface{}
	Expiration int64
}

func (MemoryCacheItem) Expired

func (item MemoryCacheItem) Expired() bool

Jump to

Keyboard shortcuts

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