Help us shape the future of Go! Take the 2026 Go Developer Survey

postgrescache

package module
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 3 Imported by: 1

Documentation

Overview

Package postgrescache provides a postgres-backed cache store wrapper over driver/sqlcore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) (cachecore.Store, error)

New builds a postgres-backed cachecore.Store using the pgx stdlib driver.

Defaults: - DefaultTTL: 5*time.Minute when zero - Prefix: "app" when empty - Table: "cache_entries" when empty - DSN: required

Example: postgres via explicit driver config

store, err := postgrescache.New(postgrescache.Config{
	BaseConfig: cachecore.BaseConfig{
		DefaultTTL: 5 * time.Minute,
		Prefix:     "app",
	},
	DSN:   "postgres://user:pass@localhost:5432/app?sslmode=disable",
	Table: "cache_entries",
})
if err != nil {
	panic(err)
}
fmt.Println(store.Driver()) // sql

Types

type Config

type Config struct {
	cachecore.BaseConfig
	DSN   string
	Table string
}

Config configures a postgres-backed cache store.

Jump to

Keyboard shortcuts

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