cache

package
v0.49.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2018 License: Apache-2.0 Imports: 1 Imported by: 36

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lazy added in v0.45.1

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

Lazy represents a lazily loaded cache.

func NewLazy added in v0.45.1

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

NewLazy creates a lazy cache with the given load func.

func (*Lazy) Get added in v0.45.1

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.

Jump to

Keyboard shortcuts

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