freecache

package
v1.0.0-dev.156 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAdd

func ConfigAdd(path string)

func NewCache

func NewCache(ctx context.Context, opts ...Option) (*freecache.Cache, error)

NewCache returns a cache.

func NewCacheWithConfigPath

func NewCacheWithConfigPath(ctx context.Context, path string, opts ...Option) (*freecache.Cache, error)

NewCacheWithConfigPath returns a cache with options from config path .

func NewCacheWithOptions

func NewCacheWithOptions(ctx context.Context, o *Options, opts ...Option) (cache *freecache.Cache, err error)

NewCacheWithOptions returns a cache with options.

Types

type Option

type Option func(options *Options)

Option represents an option.

func WithCacheSize

func WithCacheSize(cacheSize int) Option

WithCacheSize returns option that defines cache size.

type Options

type Options struct {
	CacheSize int
}

Options represents cache options.

func NewOptions

func NewOptions() (*Options, error)

NewOptions returns options from config file or environment vars.

func NewOptionsWithPath

func NewOptionsWithPath(path string) (opts *Options, err error)

NewOptionsWithPath unmarshals a given key path into options and returns it. NewOptionsWithPath unmarshals a given key path into options and returns it.

Jump to

Keyboard shortcuts

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