Documentation ¶
Index ¶
- Variables
- type Cache
- type DiskCache
- func (d *DiskCache) Close() error
- func (d *DiskCache) Collect(ch chan<- prometheus.Metric)
- func (d *DiskCache) Delete(ctx context.Context, key string) error
- func (d *DiskCache) DeleteExpiredEntries(maxAge time.Time) (int, error)
- func (d *DiskCache) Describe(descs chan<- *prometheus.Desc)
- func (d *DiskCache) Get(ctx context.Context, key string) ([]byte, error)
- func (d *DiskCache) Set(ctx context.Context, key string, data []byte, options *SetEntryOptions) error
- type SetEntryOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotExist is returned if the entry does not exist. ErrNotExist = errors.New("entry does not exist") )
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // Get retrieves an entry. If the entry does not exist, ErrNotExist is // returned. Get(ctx context.Context, key string) ([]byte, error) // Set inserts an entry. Set(ctx context.Context, key string, data []byte, options *SetEntryOptions) error // Delete deletes an entry. If the entry does not exist, nothing is done and a // nil error is returned. Delete(ctx context.Context, key string) error }
Cache stores key-value pairs for quick retrieval. It is safe to use a Cache implementation from multiple goroutines simultaneously.
type DiskCache ¶
type DiskCache struct {
// contains filtered or unexported fields
}
DiskCache implements Cache by storing values to disk.
func NewDiskCache ¶
NewDiskCache returns a DiskCache that stores its data in a file at the specified path.
func (*DiskCache) Collect ¶
func (d *DiskCache) Collect(ch chan<- prometheus.Metric)
Collect implements prometheus.Collector.
func (*DiskCache) DeleteExpiredEntries ¶
DeleteExpiredEntries deletes all expired entries.
func (*DiskCache) Describe ¶
func (d *DiskCache) Describe(descs chan<- *prometheus.Desc)
Describe implements prometheus.Collector.
type SetEntryOptions ¶
Click to show internal directories.
Click to hide internal directories.