mysqlcache

package module
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package mysqlcache provides a mysql-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 mysql-backed cachecore.Store.

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

Example: mysql via explicit driver config

store, err := mysqlcache.New(mysqlcache.Config{
	BaseConfig: cachecore.BaseConfig{
		DefaultTTL: 5 * time.Minute,
		Prefix:     "app",
	},
	DSN:   "user:pass@tcp(127.0.0.1:3306)/app?parseTime=true",
	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 mysql-backed cache store.

Jump to

Keyboard shortcuts

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