cache

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cache provides a factory function to create Cache instances.

Index

Constants

View Source
const (
	DefaultDriver = "memory" // Define a default driver
)
View Source
const Module = "storage.cache"

Variables

This section is empty.

Functions

func New

New creates a new Cache instance based on the provided configuration. It uses the internal factory registry to find the appropriate provider. To use a specific provider (e.g., "redis"), ensure its package is imported for its side effects (e.g., `import _ "path/to/redis/provider"`), which will register the provider's factory.

func Register added in v0.2.13

func Register(name string, factory Factory)

Register registers a new cache factory with the default factory registry.

Types

type Factory added in v0.2.13

type Factory interface {
	NewCache(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)
}

Factory is the interface for creating new Cache components.

type FactoryFunc added in v0.2.13

type FactoryFunc func(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)

FactoryFunc is a function type that implements the Factory interface.

func (FactoryFunc) NewCache added in v0.2.13

func (f FactoryFunc) NewCache(cfg *cachev1.CacheConfig, opts ...options.Option) (storageiface.Cache, error)

NewCache creates a new Cache component based on the provided configuration.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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