Documentation ¶
Overview ¶
Package requestcache provides functions for caching on-demand generated data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FileExtension = ".dat"
FileExtension is appended to request key names to make up the names of files being written to disk.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a holder for one or multiple caches.
func NewCache ¶
NewCache creates a new set of caches for on-demand generated content, where processor numProcessors is the number of processors that will be working in parallel and cachefuncs are the caches to be used, listed in order of priority.
func (*Cache) NewRequest ¶
NewRequest creates a new request where job is the job to be run.
type CacheFunc ¶
A CacheFunc can be used to store request results in a cache.
func Disk ¶
Disk manages an on-disk cache of results, where dir is the directory in which to store results.
func GoogleCloudStorage ¶
GoogleCloudStorage manages an cache of results in Google Cloud Storage, where bucket is the bucket in which to store results and subdir is the bucket subdirectory, if any, that should be used.
func HTTP ¶
HTTP retrieves cached requests over an HTTP connection, where addr is the address where results are stored. This function does not cache requests, it only retrieves previously cached requests.
type Job ¶
type Job interface { // Run runs the job and fills the provided result. Run(context.Context, Result) error // Key returns a unique identifier for this job. Key() string }
A job specifies a unit of work to be run and cached with a unique key.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request holds information about a request that is to be handled either by a cache or a ProcessFunc.
type Result ¶
type Result interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler }