cache

package
v1.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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