cache

package
v0.0.0-...-949c8fb Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module("cache",
	config.Load(&Config{}),
	fx.Provide(NewCache),
)

Functions

This section is empty.

Types

type Cache

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

func NewCache

func NewCache(lc fx.Lifecycle, deps CacheDeps) (*Cache, error)

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) Delete

func (c *Cache) Delete(context context.Context, key string) error

func (*Cache) Get

func (c *Cache) Get(context context.Context, key string) (any, bool)

func (*Cache) Set

func (c *Cache) Set(context context.Context, key string, value any) error

type CacheDeps

type CacheDeps struct {
	fx.In

	Config *Config
}

type Config

type Config struct {
	TTL int `env:"CACHE_TTL,default=300"`
}

func (*Config) CacheTTLSecond

func (c *Config) CacheTTLSecond() time.Duration

Jump to

Keyboard shortcuts

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