memcache

package
v0.0.0-...-9cfc599 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemCache

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

MemCache is a cache implementation that stores items in memory. It is uses as a cache-aside pattern.

func New

func New(logger *slog.Logger, repo repository) *MemCache

New creates a new dbCache instance.

func (*MemCache) Get

func (c *MemCache) Get(id string) (*service.Item, error)

Get retrieves an item by its ID from the cache or the database.

func (*MemCache) Store

func (c *MemCache) Store(item service.Item)

Store inserts a new item into the database and the cache.

Jump to

Keyboard shortcuts

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