provider

package
v0.0.4-alpha Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package provider is the default hex/cache service provider.

It picks a cache backend based on config and binds it into the container. v1 only understands the memory backend; add a Backend hook to plug in Redis/memcached/etc. from your app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configs

func Configs() fs.FS

Configs returns the embedded default TOML + CUE files this provider contributes to hex/config. Add it to hex/config.Provider.Sources.

Types

type Provider

type Provider struct {
	provider.Base

	// Binding is the container name for the cache. Defaults to "cache".
	Binding string

	// Namespace is the config namespace read for cache settings.
	// Defaults to "cache".
	Namespace string

	// Backend overrides the built-in backend selection. When set, the
	// factory function runs and its return value is bound directly —
	// the provider does not consult Namespace.driver in that case.
	Backend func() cache.Cache
	// contains filtered or unexported fields
}

Provider binds a cache.Cache into the container.

func (*Provider) Register

func (p *Provider) Register(app provider.Application) error

Register selects the backend and binds it.

Jump to

Keyboard shortcuts

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