fake

package
v1.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 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 {
	GetCalls           int
	SetCalls           int
	SuccessfulGetCalls int
	FailedGetCalls     int
	// contains filtered or unexported fields
}

MockCache is a simple map-based cache usable 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]) ItemCount added in v1.0.1

func (m *FakeCache[T]) ItemCount() int

func (*FakeCache[T]) Set

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

func (*FakeCache[T]) SetWithDefaultTTL added in v1.2.1

func (m *FakeCache[T]) SetWithDefaultTTL(key string, value T, cost uint64) 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