Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: logdog/server/service/config/opts.go

Issue 2647083003: LogDog: Use luci_config/server packages for config (Closed)
Patch Set: Comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « logdog/server/service/config/flag_test.go ('k') | logdog/server/service/service.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package config
6
7 import (
8 "time"
9
10 "github.com/luci/luci-go/luci_config/server/cfgclient/backend"
11 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/caching"
12
13 "golang.org/x/net/context"
14 )
15
16 // CacheOptions is the set of configuration options.
17 type CacheOptions struct {
18 // CacheExpiration is the amount of time that a config entry should be c ached.
19 //
20 // If this value is <= 0, no configuration caching will be enabled. This
21 // should not be set for production systems.
22 CacheExpiration time.Duration
23 }
24
25 // WrapBackend wraps the supplied base backend in caching layers and returns a
26 // Conext with the resulting backend installed.
27 func (o *CacheOptions) WrapBackend(c context.Context, base backend.B) context.Co ntext {
28 return backend.WithFactory(c, func(c context.Context) backend.B {
29 // Start with our base Backend.
30 be := base
31
32 // Add a proccache-based config cache.
33 if o.CacheExpiration > 0 {
34 be = caching.ProcCache(be, o.CacheExpiration)
35 }
36
37 return be
38 })
39 }
OLDNEW
« no previous file with comments | « logdog/server/service/config/flag_test.go ('k') | logdog/server/service/service.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698