caching

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BigCacheBucket

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

func NewBigCacheByConfig

func NewBigCacheByConfig(config bigcache.Config) *BigCacheBucket

func NewSimpleBigCache

func NewSimpleBigCache(duration time.Duration) *BigCacheBucket

func (*BigCacheBucket) Evict

func (b *BigCacheBucket) Evict(key string) error

func (*BigCacheBucket) Get

func (b *BigCacheBucket) Get(key string, result any) error

func (*BigCacheBucket) Put

func (b *BigCacheBucket) Put(key string, data any) error

type CacheBucket

type CacheBucket interface {

	// Get 获取指定key对应的值
	// result 值类型指针
	Get(key string, result any) error

	// Put 设置key对应值
	Put(key string, data any) error

	// Evict 清除缓存
	Evict(key string) error
}

type CacheManager

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

func NewCacheBucketManager

func NewCacheBucketManager(bucketName string, bucket CacheBucket) *CacheManager

func NewEmptyCacheBucketManager

func NewEmptyCacheBucketManager() *CacheManager

func (*CacheManager) AddBucket

func (c *CacheManager) AddBucket(bucketName string, bucket CacheBucket)

func (*CacheManager) Evict

func (c *CacheManager) Evict(bucketName, key string) error

func (*CacheManager) Get

func (c *CacheManager) Get(bucketName, key string, result any) error

func (*CacheManager) GetBucket

func (c *CacheManager) GetBucket(bucketName string) CacheBucket

func (*CacheManager) Put

func (c *CacheManager) Put(bucketName, key string, data any) error

Jump to

Keyboard shortcuts

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