cache01

package
v0.0.0-...-9799ab4 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const FILENAME = "config.ini"
View Source
const KEY_NAME = "timeout"
View Source
const SECTION_NAME = "cache-cfg"

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(
	dir *CacheDir,
	filename string,

	cb func() ([]byte, error),
) (*Cache, error)

func (*Cache) GetFileName

func (self *Cache) GetFileName() string

func (*Cache) GetValue

func (self *Cache) GetValue() ([]byte, error)

func (*Cache) SetValue

func (self *Cache) SetValue(value []byte) error

type CacheDir

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

func NewCacheDir

func NewCacheDir(directory string, settings *Settings) (*CacheDir, error)

func (*CacheDir) Cache

func (self *CacheDir) Cache(name string, cb func() ([]byte, error)) (*Cache, error)

func (*CacheDir) GetCfgFileName

func (self *CacheDir) GetCfgFileName() string

func (*CacheDir) GetTimeout

func (self *CacheDir) GetTimeout() (time.Duration, error)

func (*CacheDir) SetTimeout

func (self *CacheDir) SetTimeout(value time.Duration) error

type Settings

type Settings struct {
	// disables the cache. cache files, though, should not be deleted until
	// CacheSingleFileLifetime passes
	PassThrough bool

	ListDirTimeout time.Duration
}

func MakeDefaultSettings

func MakeDefaultSettings() *Settings

Jump to

Keyboard shortcuts

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