sqlite

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package sqlite is the Cache adapter backed by a sqlite file, normally $XDG_STATE_HOME/scrutiny/cache.db.

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 is a sqlite-backed cache.Cache.

func Open

func Open(path string) (*Cache, error)

Open opens (creating if needed) the cache database at path.

func (*Cache) AddCounts

func (c *Cache) AddCounts(ctx context.Context, buckets []metrics.Bucket) error

AddCounts adds to the per-minute metric counts.

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) CountsSince

func (c *Cache) CountsSince(ctx context.Context, since time.Time) ([]metrics.Bucket, error)

CountsSince returns the metric counts from since on, by name and minute.

func (*Cache) Delete

func (c *Cache) Delete(ctx context.Context, key string) error

func (*Cache) DeletePrefix

func (c *Cache) DeletePrefix(ctx context.Context, prefix string) error

DeletePrefix compares with substr rather than LIKE, so keys holding % or _ match literally.

func (*Cache) DeleteVisit

func (c *Cache) DeleteVisit(ctx context.Context, pr domain.PRRef) error

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, key string) (cache.Entry, bool, error)

func (*Cache) PruneCounts

func (c *Cache) PruneCounts(ctx context.Context, before time.Time) error

PruneCounts deletes metric counts from before before.

func (*Cache) Put

func (c *Cache) Put(ctx context.Context, key string, e cache.Entry) error

func (*Cache) RecentVisits

func (c *Cache) RecentVisits(ctx context.Context, limit int) ([]cache.Visit, error)

func (*Cache) RecordVisit

func (c *Cache) RecordVisit(ctx context.Context, v cache.Visit) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL