cache

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlobCache

type BlobCache interface {
	Add(key string, p []byte, opts ...Option)
	FetchAt(key string, offset int64, p []byte, opts ...Option) (n int, err error)
}

func NewDirectoryCache

func NewDirectoryCache(directory string, config DirectoryCacheConfig) (BlobCache, error)

func NewMemoryCache

func NewMemoryCache() BlobCache

type DirectoryCacheConfig

type DirectoryCacheConfig struct {
	MaxLRUCacheEntry int
	MaxCacheFds      int
	SyncAdd          bool
}

type Option

type Option func(o *cacheOpt) *cacheOpt

func Direct

func Direct() Option

When Direct option is specified for FetchAt and Add methods, these operation won't use on-memory caches. When you know that the targeting value won't be used immediately, you can prevent the limited space of on-memory caches from being polluted by these unimportant values.

Jump to

Keyboard shortcuts

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