fake

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeCache

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

MockCache is a simple map-based cache useable in tests without using a real cache.

func NewFakeCache

func NewFakeCache[T any]() FakeCache[T]

func (FakeCache[T]) Close

func (m FakeCache[T]) Close()

func (FakeCache[T]) Delete

func (m FakeCache[T]) Delete(key string)

func (FakeCache[T]) Get

func (m FakeCache[T]) Get(key string) (T, bool)

func (FakeCache[T]) Set

func (m FakeCache[T]) Set(key string, value T, cost uint64, expiresInSeconds int64) error

type FakeCacheItem

type FakeCacheItem[T any] struct {
	Value  T
	Cost   uint64
	Expiry int64
}

Jump to

Keyboard shortcuts

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