pgx

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound             = errors.New("key not found")
	DefaultOperationTimeout = 10 * time.Second
	DefaultCleanupInterval  = 5 * time.Minute
	DefaultTableName        = "cache_entries"
)

Functions

This section is empty.

Types

type Cache

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

func New

func New(ctx context.Context, pool *pgxpool.Pool, opts ...Option) (*Cache, error)

func NewStdLib

func NewStdLib(ctx context.Context, db *sql.DB, opts ...Option) (*Cache, error)

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) Get

func (c *Cache) Get(key string) (any, error)

func (*Cache) Keys

func (c *Cache) Keys(prefix string) []string

func (*Cache) Pop

func (c *Cache) Pop(key string) (any, error)

func (*Cache) Remove

func (c *Cache) Remove(keys ...string) error

func (*Cache) Set

func (c *Cache) Set(key string, value any, ttl time.Duration) error

type Option

type Option func(*Cache)

func WithTableName

func WithTableName(name string) Option

Jump to

Keyboard shortcuts

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