Documentation
¶
Overview ¶
Package testocache provides caching primitives to be used by external plugins.
By default, it stores cache in a directory "$TWD/.testo_cache", where "$TWD" refers to the "test working directory" (not necessary a project root). Usually, this is a directory where "_test.go" file, which calls this package, is located.
Can be overridden passing "-cache.dir ~/My/Dir" flag to the "go test" command OR (with lesser priority) with environment variable "TESTO_CACHE_DIR".
Caching can also be disabled with flag "-cache.disable" or environtment variable "TESTO_CACHE_DISABLE" (e.g. "=true").
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDisabled = errors.New("cache is disabled")
ErrDisabled indicates that caching is disabled.
Functions ¶
func Disabled ¶
func Disabled() bool
Disabled returns true if caching is disabled. It's up to the package user to handle disabled state, e.g. do not save objects in cache when this function returns true.
func Get ¶
Get cached object by the given key.
If cache is disabled (see Disabled), this function returns ErrDisabled.
func Keys ¶
Keys returns all glob-matched keys by the given pattern. E.g. "myplugin-prefix-*"
If cache is disabled (see Disabled), this function returns ErrDisabled.
func Remove ¶
Remove object from cache by the given key.
If cache is disabled (see Disabled), this function returns ErrDisabled.
Types ¶
This section is empty.