cache

package
v0.0.0-...-fba4924 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultContentFile = "content.txt"

DefaultContentFile contains the name of the file where to store processed content

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Store the item to the cache with provided content
	Store(item Item, content []byte) error
	// IsPageCached checks whether the page is in the cache
	IsPageCached(nm ItemNamespace) bool
	// IsItemCached checks whether the item is in the cache
	// Deprecated: use IsPageCached instead
	IsItemCached(item Item) bool
	// GetContent returns the content for the item
	GetContent(item Item) []byte
	// Invalidate the cache content
	Invalidate(sel models.RunSelector)
}

Cache interface

func NewCache

func NewCache(cacheCfg config.CacheCfg, date time.Time) Cache

NewCache creates an instance of the new cache

type Item

type Item struct {
	// Namespace of the item
	Namespace ItemNamespace
	// FileName of the file that will be/is stored in the cache
	FileName string
	// CachePolicy for the item - it can be nocache
	CachePolicy string
}

Item represents an unique item stored in the cache

type ItemNamespace

type ItemNamespace struct {
	// Page codename
	Page string
	// Category codename
	Category string
}

ItemNamespace contains tuple Category/Page

func NewNamespace

func NewNamespace(cat string, page string) ItemNamespace

NewNamespace creates a instance of the new ItemNamespace

func (ItemNamespace) Path

func (n ItemNamespace) Path() string

Path returns the path representation of the namespace (OS specific)

func (ItemNamespace) String

func (n ItemNamespace) String() string

String returns the string representation of the namespace

type NamespacePath

type NamespacePath interface {
	// Path return the path of the item
	Path() string
}

NamespacePath defines a generic interface for each type to have method to return the namespace path

Jump to

Keyboard shortcuts

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