hugo: Index | Files | Directories

package cache

import ""


Package Files


type Lazy Uses

type Lazy struct {
    // contains filtered or unexported fields

Lazy represents a lazily loaded cache.

func NewLazy Uses

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

NewLazy creates a lazy cache with the given load func.

func (*Lazy) Get Uses

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 Uses

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 Uses

type PartitionedLazyCache struct {
    // contains filtered or unexported fields

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

func NewPartitionedLazyCache Uses

func NewPartitionedLazyCache(partitions ...Partition) *PartitionedLazyCache

NewPartitionedLazyCache creates a new NewPartitionedLazyCache with the supplied partitions.

func (*PartitionedLazyCache) Get Uses

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.


namedmemcachePackage namedmemcache provides a memory cache with a named lock.

Package cache imports 1 packages (graph) and is imported by 40 packages. Updated 2020-02-19. Refresh now. Tools for package owners.