go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/gae/service/memcache/raw_interface.go (about) 1 // Copyright 2015 The LUCI Authors. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package memcache 16 17 // RawCB is a simple error callback for most of the methods in RawInterface. 18 type RawCB func(error) 19 20 // RawItemCB is the callback for RawInterface.GetMulti. It takes the retrieved 21 // item and the error for that item (e.g. ErrCacheMiss) if there was one. Item 22 // is guaranteed to be nil if error is not nil. 23 type RawItemCB func(Item, error) 24 25 // RawInterface is the full interface to the memcache service. 26 type RawInterface interface { 27 NewItem(key string) Item 28 29 AddMulti(items []Item, cb RawCB) error 30 SetMulti(items []Item, cb RawCB) error 31 GetMulti(keys []string, cb RawItemCB) error 32 DeleteMulti(keys []string, cb RawCB) error 33 CompareAndSwapMulti(items []Item, cb RawCB) error 34 35 Increment(key string, delta int64, initialValue *uint64) (newValue uint64, err error) 36 37 Flush() error 38 39 Stats() (*Statistics, error) 40 }