cache

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: GPL-3.0 Imports: 8 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
)
View Source
const (
	// DefaultCORSCacheSize is a default maximum number of entries in cache.
	DefaultCORSCacheSize = 1e3
	// DefaultCORSCacheLifetime is a default lifetime of entries in cache.
	DefaultCORSCacheLifetime = 5 * time.Minute
)
View Source
const (
	DefaultNetmapCacheLifetime = 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, cidCache bool) *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) GetByCID added in v0.33.0

func (o *BucketCache) GetByCID(cnrID cid.ID) *data.BucketInfo

func (*BucketCache) Put

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

Put puts an object to cache.

type CORSCache added in v0.33.0

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

CORSCache contains cache with CORS objects.

func NewCORSCache added in v0.33.0

func NewCORSCache(config *Config) *CORSCache

NewCORSCache creates an object of CORSCache.

func (*CORSCache) Get added in v0.33.0

func (o *CORSCache) Get(cnrID cid.ID) *data.CORSConfiguration

Get returns a cached object.

func (*CORSCache) Put added in v0.33.0

func (o *CORSCache) Put(cnrID cid.ID, cors *data.CORSConfiguration) 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.

func DefaultCORSConfig added in v0.33.0

func DefaultCORSConfig(logger *zap.Logger) *Config

DefaultCORSConfig returns new default cache expiration values.

type NetmapCache added in v0.33.0

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

NetmapCache provides cache for netmap.

func NewNetmapCache added in v0.33.0

func NewNetmapCache(config *NetmapCacheConfig) *NetmapCache

NewNetmapCache creates an object of NetmapCache.

func (*NetmapCache) Get added in v0.33.0

func (c *NetmapCache) Get() *netmap.NetMap

func (*NetmapCache) Put added in v0.33.0

func (c *NetmapCache) Put(nm netmap.NetMap) error

type NetmapCacheConfig added in v0.33.0

type NetmapCacheConfig struct {
	Lifetime time.Duration
	Logger   *zap.Logger
}

NetmapCacheConfig stores expiration params for cache.

func DefaultNetmapConfig added in v0.33.0

func DefaultNetmapConfig(logger *zap.Logger) *NetmapCacheConfig

DefaultNetmapConfig returns new default cache expiration values.

Jump to

Keyboard shortcuts

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