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

Side by Side Diff: service/memcache/types.go

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 years, 3 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 | « service/memcache/memcache.go ('k') | service/module/context.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package memcache 5 package memcache
6 6
7 import ( 7 import (
8 "time" 8 "time"
9 ) 9 )
10 10
11 // Statistics represents a set of statistics about the memcache cache. This 11 // Statistics represents a set of statistics about the memcache cache. This
12 // may include items that have expired but have not yet been removed from the 12 // may include items that have expired but have not yet been removed from the
13 // cache. 13 // cache.
14 type Statistics struct { 14 type Statistics struct {
15 Hits uint64 // Counter of cache hits 15 Hits uint64 // Counter of cache hits
16 Misses uint64 // Counter of cache misses 16 Misses uint64 // Counter of cache misses
17 ByteHits uint64 // Counter of bytes transferred for gets 17 ByteHits uint64 // Counter of bytes transferred for gets
18 18
19 Items uint64 // Items currently in the cache 19 Items uint64 // Items currently in the cache
20 Bytes uint64 // Size of all items currently in the cache 20 Bytes uint64 // Size of all items currently in the cache
21 21
22 Oldest int64 // Age of access of the oldest item, in seconds 22 Oldest int64 // Age of access of the oldest item, in seconds
23 } 23 }
24 24
25 // Item is a wrapper around *memcache.Item. Note that the Set* methods all 25 // Item is a wrapper around *memcache.Item. Note that the Set* methods all
26 // return the original Item (e.g. they mutate the original), due to 26 // return the original Item (e.g. they mutate the original), due to
27 // implementation constraints. They return the original item to allow easy 27 // implementation constraints. They return the original item to allow easy
28 // chaining, e.g.: 28 // chaining, e.g.:
29 // itm := memcache.Get(c).NewItem("foo").SetValue([]byte("stuff")) 29 // itm := memcache.NewItem(c, "foo").SetValue([]byte("stuff"))
30 type Item interface { 30 type Item interface {
31 Key() string 31 Key() string
32 Value() []byte 32 Value() []byte
33 Flags() uint32 33 Flags() uint32
34 Expiration() time.Duration 34 Expiration() time.Duration
35 35
36 SetKey(string) Item 36 SetKey(string) Item
37 SetValue([]byte) Item 37 SetValue([]byte) Item
38 SetFlags(uint32) Item 38 SetFlags(uint32) Item
39 SetExpiration(time.Duration) Item 39 SetExpiration(time.Duration) Item
40 40
41 // SetAll copies all the values from other, except Key, into this item 41 // SetAll copies all the values from other, except Key, into this item
42 // (including the hidden CasID field). If other is nil, then all non-Key 42 // (including the hidden CasID field). If other is nil, then all non-Key
43 // fields are reset. 43 // fields are reset.
44 SetAll(other Item) 44 SetAll(other Item)
45 } 45 }
OLDNEW
« no previous file with comments | « service/memcache/memcache.go ('k') | service/module/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698