cache

package
v1.16.3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cache defines utilities for caching data or state.

Index

Constants

View Source
const (
	// Apply caching wherever possible
	Apply = iota
	// NoCache directive does not prevent the storing of data but instead prevents the reuse of data without revalidation
	NoCache
	// NoStore directive ensures there is no caching performed at all
	NoStore
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Control

type Control int

type IServerCache

type IServerCache interface {
	// SetCacheControl specifies the caching behaviour.
	SetCacheControl(control Control) error
	// GetCacheControl returns the caching behaviour followed.
	GetCacheControl() Control
	// SetKey sets  an explicit key for restoring and saving the cache
	SetKey(key string) error
	// GetKey returns  an explicit key for restoring a cache
	GetKey() string
	// Invalidate invalidates all cache entries.
	Invalidate(ctx context.Context) error
}

IServerCache defines a caching mechanism server-side.

func NewServiceCache

func NewServiceCache() IServerCache

NewServiceCache creates a service cache.

type ServiceCache

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

func (*ServiceCache) GetCacheControl

func (c *ServiceCache) GetCacheControl() Control

func (*ServiceCache) GetKey

func (c *ServiceCache) GetKey() string

func (*ServiceCache) Invalidate

func (c *ServiceCache) Invalidate(context.Context) error

func (*ServiceCache) SetCacheControl

func (c *ServiceCache) SetCacheControl(control Control) error

func (*ServiceCache) SetKey

func (c *ServiceCache) SetKey(key string) (err error)

Jump to

Keyboard shortcuts

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