datastore

package
v0.0.0-...-a0a3655 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// RPCDeadline is the deadline applied to config service RPCs.
	RPCDeadline = 10 * time.Minute
)

Variables

View Source
var Cache = datastorecache.Cache{
	Name:                 "go.chromium.org/luci/appengine/gaeconfig",
	AccessUpdateInterval: 24 * time.Hour,
	PruneFactor:          4,
	Parallel:             16,
	HandlerFunc:          getCacheHandler,
}

Cache is our registered datastore cache, bound to our Config Handler. The generator function is used by the cache manager task to get a Handler instance during refresh.

Functions

func CronLoader

func CronLoader(b backend.B) caching.Loader

CronLoader returns a caching.Loader implementation to be used by the Cron task.

Types

type Config

type Config struct {
	// RefreshInterval is the cache entry refresh interval.
	RefreshInterval time.Duration
	// FailOpen, if true, means that a cache miss or failure should be passed
	// through to the underlying cache.
	FailOpen bool

	// LockerFunc returns the Locker instance to use.
	LockerFunc func(context.Context) datastorecache.Locker
	// contains filtered or unexported fields
}

Config is a datastore cache configuration.

Cache parameters can be extracted from a config instance.

func (*Config) Backend

func (dc *Config) Backend(base backend.B) backend.B

Backend wraps the specified Backend in a datastore-backed cache.

func (*Config) WithHandler

func (dc *Config) WithHandler(c context.Context, l caching.Loader, timeout time.Duration) context.Context

WithHandler installs a datastorecache.Handler into our Context. This is used during datastore cache's Refresh calls.

The Handler binds the parameters and Loader to the resolution call. For service resolution, this will be the Loader that is provided by the caching layer. For cron refresh, this will be the generic Loader provided by CronLoader.

Jump to

Keyboard shortcuts

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