-
Notifications
You must be signed in to change notification settings - Fork 2
/
memcache.go
34 lines (30 loc) · 929 Bytes
/
memcache.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package appwrap
import "time"
type Memcache interface {
Add(item *CacheItem) error
AddMulti(item []*CacheItem) error
CompareAndSwap(item *CacheItem) error
Delete(key string) error
DeleteMulti(keys []string) error
Flush() error
FlushShard(shard int) error
Get(key string) (*CacheItem, error)
GetMulti(keys []string) (map[string]*CacheItem, error)
Increment(key string, amount int64, initialValue uint64, initialExpires time.Duration) (uint64, error)
IncrementExisting(key string, amount int64) (uint64, error)
Namespace(ns string) Memcache
Set(item *CacheItem) error
SetMulti(item []*CacheItem) error
}
type CacheLocation string
type CacheName string
type CacheShards int64
type CacheItem struct {
Key string
Value []byte
casTime interface{} // used by localmemcache for CAS
Flags uint32
Expiration time.Duration
// Used for CompareAndSwap, invisible to client
valueOnLastGet []byte
}