luci: Index | Files

package datastore

import ""


Package Files



const (

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


var Cache = datastorecache.Cache{
    Name:                 "",
    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.

func CronLoader Uses

func CronLoader(b backend.B) caching.Loader

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

type Config Uses

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 Uses

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

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

func (*Config) WithHandler Uses

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.

Package datastore imports 10 packages (graph) and is imported by 3 packages. Updated 2020-05-31. Refresh now. Tools for package owners.