cache

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package cache for backend cache

Index

Constants

This section is empty.

Variables

View Source
var BackendCacheProvider = BackendCacheInterface(nil)

BackendCacheProvider provider for backend cache

Functions

This section is empty.

Types

type BackendCache

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

BackendCache contains backendItems and mutex

func NewBackendCache

func NewBackendCache() *BackendCache

NewBackendCache init backend backend

func (*BackendCache) Clear

func (b *BackendCache) Clear(ctx context.Context)

Clear set backend cache empty

func (*BackendCache) Count

func (b *BackendCache) Count() int

Count get backend cache length

func (*BackendCache) Delete

func (b *BackendCache) Delete(ctx context.Context, backendName string)

Delete delete backend cache by backendName

func (*BackendCache) List

func (b *BackendCache) List(ctx context.Context) []model.Backend

List get all backend cache

func (*BackendCache) Load

func (b *BackendCache) Load(backendName string) (model.Backend, bool)

Load get backend from cache

func (*BackendCache) PrintCacheContent

func (b *BackendCache) PrintCacheContent(ctx context.Context)

PrintCacheContent print current backend cache

func (*BackendCache) Store

func (b *BackendCache) Store(ctx context.Context, backendName string, backend model.Backend)

Store save backend to cache

type BackendCacheInterface

type BackendCacheInterface interface {
	// Store save backend to cache
	Store(ctx context.Context, backendName string, backend model.Backend)

	// Load get backend from cache
	Load(backendName string) (model.Backend, bool)

	// Delete delete backend cache by backendName
	Delete(ctx context.Context, backendName string)

	// Clear set backend cache empty
	Clear(ctx context.Context)

	// List get all backend cache
	List(ctx context.Context) []model.Backend

	// Count get backend cache length
	Count() int

	// PrintCacheContent print current backend cache
	PrintCacheContent(ctx context.Context)
}

BackendCacheInterface interface for backend cache

Jump to

Keyboard shortcuts

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