cache

package
v0.0.0-...-870068e Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const PARTITION_MOVIE_DETAILS = 1

Variables

This section is empty.

Functions

func Lookup

func Lookup[T any](ctx context.Context, q *Queries, partition int64, cacheKey string) (*T, error)

func Migrate

func Migrate(conn *sql.DB) error

Migrate applies all pending schema migrations to the cache database.

func Write

func Write[T any](ctx context.Context, q *Queries, partition int64, cacheKey string, value T, expires time.Time) error

Types

type CacheItem

type CacheItem struct {
	Partition  int64
	CacheKey   string
	CacheValue []byte
	Expires    int64
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type LookupParams

type LookupParams struct {
	Partition int64
	CacheKey  string
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) DeleteExpired

func (q *Queries) DeleteExpired(ctx context.Context) error

func (*Queries) Lookup

func (q *Queries) Lookup(ctx context.Context, arg LookupParams) ([]CacheItem, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

func (*Queries) Write

func (q *Queries) Write(ctx context.Context, arg WriteParams) error

type WriteParams

type WriteParams struct {
	Partition  int64
	CacheKey   string
	CacheValue []byte
	Expires    int64
}

Jump to

Keyboard shortcuts

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