cache

package
v0.30.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBucketCacheSize is a default maximum number of entries in cache.
	DefaultBucketCacheSize = 1e3
	// DefaultBucketCacheLifetime is a default lifetime of entries in cache.
	DefaultBucketCacheLifetime = time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketCache

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

BucketCache contains cache with objects and the lifetime of cache entries.

func NewBucketCache

func NewBucketCache(config *Config) *BucketCache

NewBucketCache creates an object of BucketCache.

func (*BucketCache) Get

func (o *BucketCache) Get(ns, bktName string) *data.BucketInfo

Get returns a cached object.

func (*BucketCache) Put

func (o *BucketCache) Put(bkt *data.BucketInfo) error

Put puts an object to cache.

type Config

type Config struct {
	Size     int
	Lifetime time.Duration
	Logger   *zap.Logger
}

Config stores expiration params for cache.

func DefaultBucketConfig

func DefaultBucketConfig(logger *zap.Logger) *Config

DefaultBucketConfig returns new default cache expiration values.

Jump to

Keyboard shortcuts

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