Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
Cache is scoped to one particular mercury server Use CacheSet to hold lookups for multiple servers
type CacheSet ¶
type CacheSet interface {
services.Service
Get(ctx context.Context, client Client) (Fetcher, error)
}
CacheSet holds a set of mercury caches keyed by server URL
type Config ¶
type Config struct {
// LatestReportTTL controls how "stale" we will allow a price to be e.g. if
// set to 1s, a new price will always be fetched if the last result was
// from more than 1 second ago.
//
// Another way of looking at it is such: the cache will _never_ return a
// price that was queried from before now-LatestReportTTL.
//
// Setting to zero disables caching entirely.
LatestReportTTL time.Duration
// MaxStaleAge is that maximum amount of time that a value can be stale
// before it is deleted from the cache (a form of garbage collection).
//
// This should generally be set to something much larger than
// LatestReportTTL. Setting to zero disables garbage collection.
MaxStaleAge time.Duration
// LatestReportDeadline controls how long to wait for a response before
// retrying. Setting this to zero will wait indefinitely.
LatestReportDeadline time.Duration
}
type Fetcher ¶
type Fetcher interface {
LatestReport(ctx context.Context, req *pb.LatestReportRequest) (resp *pb.LatestReportResponse, err error)
}
Click to show internal directories.
Click to hide internal directories.