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

Unified Diff: service/memcache/types.go

Issue 1243323002: Refactor a bit. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: fix golint Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/memcache/interface.go ('k') | service/rawdatastore/context.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/memcache/types.go
diff --git a/service/memcache/types.go b/service/memcache/types.go
new file mode 100644
index 0000000000000000000000000000000000000000..1bc49d8cde1cc123d664337ac0f6e317059eb819
--- /dev/null
+++ b/service/memcache/types.go
@@ -0,0 +1,42 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package memcache
+
+import (
+ "time"
+)
+
+// Statistics represents a set of statistics about the memcache cache. This
+// may include items that have expired but have not yet been removed from the
+// cache.
+type Statistics struct {
+ Hits uint64 // Counter of cache hits
+ Misses uint64 // Counter of cache misses
+ ByteHits uint64 // Counter of bytes transferred for gets
+
+ Items uint64 // Items currently in the cache
+ Bytes uint64 // Size of all items currently in the cache
+
+ Oldest int64 // Age of access of the oldest item, in seconds
+}
+
+// Item is a wrapper around *memcache.Item. Note that the Set* methods all
+// return the original Item (e.g. they mutate the original), due to
+// implementation constraints. They return the original item to allow easy
+// chaining, e.g.:
+// itm := memcache.Get(c).NewItem("foo").SetValue([]byte("stuff"))
+type Item interface {
+ Key() string
+ Value() []byte
+ Object() interface{}
+ Flags() uint32
+ Expiration() time.Duration
+
+ SetKey(string) Item
+ SetValue([]byte) Item
+ SetObject(interface{}) Item
+ SetFlags(uint32) Item
+ SetExpiration(time.Duration) Item
+}
« no previous file with comments | « service/memcache/interface.go ('k') | service/rawdatastore/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698