cacheDB

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize()

Types

type Cache

type Cache[T any] struct {
	// contains filtered or unexported fields
}

Cache struct

func NewCache

func NewCache[T any](name string, ttl time.Duration) *Cache[T]

NewCache create a new pointer to Cache struct.

func (*Cache[T]) Del

func (c *Cache[T]) Del(ctx context.Context) error

Del delete data in cachedDB

func (*Cache[T]) Many

func (c *Cache[T]) Many(ctx context.Context) ([]T, error)

Many returns a slice of T value

func (*Cache[T]) One

func (c *Cache[T]) One(ctx context.Context) (*T, error)

One return a pointer of T value

func (*Cache[T]) Set

func (c *Cache[T]) Set(ctx context.Context, data any) error

Set save data in cacheDB

Jump to

Keyboard shortcuts

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