Documentation
¶
Overview ¶
Package cache provides functionality for managing a cache located on the file system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache represents a cache located on the file system.
func New ¶
New creates an uninitialized cache.
If location is an empty string the location will default to the user's home directory.
If ephemeral is set the cache will be located in a unique directory in the system's temporary directory (and the given location is ignored).
func (*Cache) Cleanup ¶
func (c *Cache) Cleanup()
Cleanup the cache if it is ephemeral, removing it.
Any errors are silently ignored under the assumption that the temporary directory will be cleaned automatically.
type Option ¶ added in v0.6.1
Option is a function to configure the cache.
func WithEphemeralCache ¶ added in v0.6.1
WithEphemeralCache makes the cache ephemeral (single-run use).
func WithEviction ¶ added in v0.6.1
WithEviction enables or disabled cache evection.
func WithLocation ¶ added in v0.6.1
WithLocation sets the location of the cache. The location is ignored when the cache is ephemeral.