options

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultMaxSizeBytes is the default maximum byte cost memory provider will admit to the cache (512 MB)
	DefaultMaxSizeBytes = int64(512 * 1024 * 1024)
	// DefaultNumCounters is the default number of keys memory provider tracks for admission control
	DefaultNumCounters = int64(500_000)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	// MaxSizeBytes is the maximum total byte cost memory provider will admit to the cache.
	// Defaults to 512MB.
	MaxSizeBytes int64 `yaml:"max_size_bytes,omitempty"`
	// NumCounters is the number of keys memory provider tracks for admission control. Not a hard limit, but a sampling size.
	// Recommended to use ~10x the number of unique keys you expect to hold for full utilization.
	// Defaults to 500,000.
	NumCounters int64 `yaml:"num_counters,omitempty"`
}

Options holds memory-cache-specific configuration.

func New

func New() *Options

New returns a new Options with default values set.

func (*Options) Equal

func (o *Options) Equal(o2 *Options) bool

Equal returns true if all members of the subject and provided Options are identical.

func (*Options) UnmarshalYAML

func (o *Options) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML applies defaults before overlaying YAML-parsed values.

Jump to

Keyboard shortcuts

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