Documentation
¶
Overview ¶
Package cache is the Cache port: a disposable local store for upstream responses and derived data. Deleting it never loses data.
Index ¶
- type Cache
- type Entry
- type Memory
- func (m *Memory) Delete(_ context.Context, key string) error
- func (m *Memory) DeletePrefix(_ context.Context, prefix string) error
- func (m *Memory) DeleteVisit(_ context.Context, pr domain.PRRef) error
- func (m *Memory) Get(_ context.Context, key string) (Entry, bool, error)
- func (m *Memory) Keys() []string
- func (m *Memory) Put(_ context.Context, key string, e Entry) error
- func (m *Memory) RecentVisits(_ context.Context, limit int) ([]Visit, error)
- func (m *Memory) RecordVisit(_ context.Context, v Visit) error
- type Visit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get returns the entry for key; ok is false when there is none.
Get(ctx context.Context, key string) (e Entry, ok bool, err error)
Put(ctx context.Context, key string, e Entry) error
// Delete removes the entry for key, if any.
Delete(ctx context.Context, key string) error
// DeletePrefix removes every entry whose key starts with prefix.
DeletePrefix(ctx context.Context, prefix string) error
// RecordVisit notes that pr was opened, replacing any earlier visit.
RecordVisit(ctx context.Context, v Visit) error
// RecentVisits returns up to limit visits, most recent first.
RecentVisits(ctx context.Context, limit int) ([]Visit, error)
// DeleteVisit removes pr from the recent visits, if it is there.
DeleteVisit(ctx context.Context, pr domain.PRRef) error
}
Cache stores entries by key, and the PRs recently opened.
Click to show internal directories.
Click to hide internal directories.