cache

package
v0.0.0-...-f47b430 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache[VT any] interface {
	Get(key string) (*VT, error)
	Set(key string, value VT) error
	Remove(key string)
	Flush()
}

func NewMemoryCache

func NewMemoryCache[T any]() Cache[T]

type MemoryCache

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

MemoryCache is the MemoryCache instance to manage session MemoryCache

func (*MemoryCache[T]) Flush

func (c *MemoryCache[T]) Flush()

Flush removes all element from the MemoryCache

func (*MemoryCache[T]) Get

func (c *MemoryCache[T]) Get(key string) (*T, error)

Get returns the user session T with respect to a key

func (*MemoryCache[T]) Remove

func (c *MemoryCache[T]) Remove(key string)

Remove deletes a key from SessionCache map

func (*MemoryCache[T]) Set

func (c *MemoryCache[T]) Set(key string, value T) error

Set sets a session T with respect to a key

Jump to

Keyboard shortcuts

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