caching

package
v0.0.0-...-6244057 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2018 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheInterface

type CacheInterface interface {
	Get() ([]byte, error)
	GetString() (string, error)

	// tell count of free bytes
	Free() uint
	GetSize() uint
	GetMaxSize() uint
	SetMaxSize(to uint)

	// get last error
	GetLastE() error
}

type CacheItem

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

type ObservingFileCache

type ObservingFileCache struct {
	StupidFileCache
	// contains filtered or unexported fields
}

* uses inotify to detect changes made to the cached files * and if so update the cache * * TODO * add error handling * add support for optional inotify delete

func NewObservingFileCache

func NewObservingFileCache() (cache *ObservingFileCache)

func NewObservingFileCacheMaxSize

func NewObservingFileCacheMaxSize(maxSize uint) (cache *ObservingFileCache)

func (*ObservingFileCache) Close

func (cache *ObservingFileCache) Close()

close

func (*ObservingFileCache) Get

func (cache *ObservingFileCache) Get(filename string) (value []byte, e error)

func (*ObservingFileCache) Remove

func (cache *ObservingFileCache) Remove(filename string)

remove from cache; stop watching goroutines.

func (*ObservingFileCache) Reset

func (cache *ObservingFileCache) Reset()

remove all files from cache

type StupidFileCache

type StupidFileCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

* a stupid cache that needs to be updated manually. * good luck with that. * * it's meant to be abstract, but can be used on its own. * * for linux see the ObservingFileCache with inotify support. * * TODO * check and correct interface definition * turn into StupidReaderCache for io.Reader * add a time based BoringFileCache * add a shared memory cache PromiscuousFileCache

func NewStupidFileCache

func NewStupidFileCache() (cache *StupidFileCache)

func NewStupidFileCacheMaxSize

func NewStupidFileCacheMaxSize(maxSize uint) (cache *StupidFileCache)

func (*StupidFileCache) Close

func (cache *StupidFileCache) Close()

remove all files from cache

func (*StupidFileCache) Free

func (cache *StupidFileCache) Free() uint

func (*StupidFileCache) Get

func (cache *StupidFileCache) Get(filename string) (value []byte, e error)

func (*StupidFileCache) GetMaxFiles

func (cache *StupidFileCache) GetMaxFiles() uint

func (*StupidFileCache) GetMaxSize

func (cache *StupidFileCache) GetMaxSize() uint

func (*StupidFileCache) GetSize

func (cache *StupidFileCache) GetSize() uint

func (*StupidFileCache) GetString

func (cache *StupidFileCache) GetString(filename string) (string, error)

func (*StupidFileCache) Remove

func (cache *StupidFileCache) Remove(filename string)

func (*StupidFileCache) Reset

func (cache *StupidFileCache) Reset()

func (*StupidFileCache) SetMaxFiles

func (cache *StupidFileCache) SetMaxFiles(to uint)

func (*StupidFileCache) SetMaxSize

func (cache *StupidFileCache) SetMaxSize(to uint)

type StupidInterface

type StupidInterface interface {
	Reset()
	Remove(filename string)
}

Jump to

Keyboard shortcuts

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