caching

package
v0.0.0-...-8dfeaa5 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	SetCacheName(name string)
	Get(cacheKey string, typeName string) (data any, loaded bool)
	Set(cacheKey string, data any, expiration time.Duration) error
	Remove(cacheKey string)
	Stats() CacheStatistic
}

type CacheStatistic

type CacheStatistic struct {
	ReadCount   int64
	WriteCount  int64
	HitCount    int64
	RemoveCount int64
}

func (CacheStatistic) HitRate

func (stat CacheStatistic) HitRate() float64

type MemoryCache

type MemoryCache struct {
	CleanInterval time.Duration
	// contains filtered or unexported fields
}

func (*MemoryCache) Get

func (cache *MemoryCache) Get(cacheKey string, typeName string) (data any, loaded bool)

func (*MemoryCache) Initialize

func (cache *MemoryCache) Initialize(serializer serialization.BinarySerializer) *MemoryCache

func (*MemoryCache) Remove

func (cache *MemoryCache) Remove(cacheKey string)

func (*MemoryCache) Set

func (cache *MemoryCache) Set(cacheKey string, data any, expiration time.Duration) error

func (*MemoryCache) SetCacheName

func (cache *MemoryCache) SetCacheName(name string)

func (*MemoryCache) Stats

func (cache *MemoryCache) Stats() CacheStatistic

Jump to

Keyboard shortcuts

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