Documentation
¶
Overview ¶
Package pgcache is a tagging.EmbeddingCache backed by PostgreSQL. It needs plain Postgres, with no extension: the embeddings of every index live in one ordinary table. It uses upserts (INSERT ... ON CONFLICT), so PostgreSQL 9.5 or newer.
The cache uses the *sql.DB it is given, so the application imports a Postgres driver and opens the database, for example with github.com/jackc/pgx/v5/stdlib:
db, err := sql.Open("pgx", "postgres://user:password@localhost:5432/app")
Several goroutines, or processes, can write at once with no special setup: a Put is one transaction of upserts made in one fixed order of the keys (model, role, hash), so two Puts of overlapping keys lock their rows in the same order and the second waits for the first instead of deadlocking with it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.