package cache

import "github.com/gohugoio/hugo/cache"

Index

Types

type Lazy

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

Lazy represents a lazily loaded cache.

func NewLazy

func NewLazy(load func() (map[string]interface{}, error)) *Lazy

NewLazy creates a lazy cache with the given load func.

func (*Lazy) Get

func (l *Lazy) Get(key string) (interface{}, bool, error)

Get initializes the cache if not already initialized, then looks up the given key.

type Partition

type Partition struct {
	Key  string
	Load func() (map[string]interface{}, error)
}

Partition represents a cache partition where Load is the callback for when the partition is needed.

type PartitionedLazyCache

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

PartitionedLazyCache is a lazily loaded cache paritioned by a supplied string key.

func NewPartitionedLazyCache

func NewPartitionedLazyCache(partitions ...Partition) *PartitionedLazyCache

NewPartitionedLazyCache creates a new NewPartitionedLazyCache with the supplied partitions.

func (*PartitionedLazyCache) Get

func (c *PartitionedLazyCache) Get(partition, key string) (interface{}, error)

Get initializes the partition if not already done so, then looks up the given key in the given partition, returns nil if no value found.

Source Files

partitioned_lazy_cache.go

Directories

PathSynopsis
cache/filecache
cache/namedmemcachePackage namedmemcache provides a memory cache with a named lock.
Version
v0.55.6
Published
May 18, 2019
Platform
js/wasm
Imports
1 packages
Last checked
2 minutes ago

Tools for package owners.