memcacheex

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package memcacheex is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	FlushAll() error
	Get(key string) (item *memcache.Item, err error)
	Touch(key string, seconds int32) (err error)
	GetMulti(keys []string) (map[string]*memcache.Item, error)
	Set(item *memcache.Item) error
	Add(item *memcache.Item) error
	Replace(item *memcache.Item) error
	CompareAndSwap(item *memcache.Item) error
	Delete(key string) error
	DeleteAll() error
	Ping() error
	Increment(key string, delta uint64) (newValue uint64, err error)
	Decrement(key string, delta uint64) (newValue uint64, err error)
}

type ClientWrapper

type ClientWrapper struct {
	// contains filtered or unexported fields
}

func NewClientWrapper

func NewClientWrapper(client Client) *ClientWrapper

func (*ClientWrapper) Add

func (cw *ClientWrapper) Add(item *memcache.Item) error

Add writes the given item, if no value already exists for its key. ErrNotStored is returned if that condition is not met.

func (*ClientWrapper) Callback

func (cw *ClientWrapper) Callback() *callbackRegistry

Callback returns callbackRegistry

func (*ClientWrapper) CompareAndSwap

func (cw *ClientWrapper) CompareAndSwap(item *memcache.Item) error

CompareAndSwap writes the given item that was previously returned by Get, if the value was neither modified or evicted between the Get and the CompareAndSwap calls. The item's Key should not change between calls but all other item fields may differ. ErrCASConflict is returned if the value was modified in between the calls. ErrNotStored is returned if the value was evicted in between the calls.

func (*ClientWrapper) Decrement

func (cw *ClientWrapper) Decrement(key string, delta uint64) (uint64, error)

Decrement atomically decrements key by delta. The return value is the new value after being decremented or an error. If the value didn't exist in memcached the error is ErrCacheMiss. The value in memcached must be an decimal number, or an error will be returned. On underflow, the new value is capped at zero and does not wrap around.

func (*ClientWrapper) Delete

func (cw *ClientWrapper) Delete(key string) error

Delete deletes the item with the provided key. The error ErrCacheMiss is returned if the item didn't already exist in the cache.

func (*ClientWrapper) DeleteAll

func (cw *ClientWrapper) DeleteAll() error

DeleteAll deletes all items in the cache.

func (*ClientWrapper) FlushAll

func (cw *ClientWrapper) FlushAll() error

func (*ClientWrapper) Get

func (cw *ClientWrapper) Get(key string) (*memcache.Item, error)

Get gets the item for the given key. ErrCacheMiss is returned for a memcache cache miss. The key must be at most 250 bytes in length.

func (*ClientWrapper) GetMulti

func (cw *ClientWrapper) GetMulti(keys []string) (map[string]*memcache.Item, error)

GetMulti is a batch version of Get. The returned map from keys to items may have fewer elements than the input slice, due to memcache cache misses. Each key must be at most 250 bytes in length. If no error is returned, the returned map will also be non-nil.

func (*ClientWrapper) Increment

func (cw *ClientWrapper) Increment(key string, delta uint64) (uint64, error)

Increment atomically increments key by delta. The return value is the new value after being incremented or an error. If the value didn't exist in memcached the error is ErrCacheMiss. The value in memcached must be an decimal number, or an error will be returned. On 64-bit overflow, the new value wraps around.

func (*ClientWrapper) Ping

func (cw *ClientWrapper) Ping() error

Ping checks all instances if they are alive. Returns error if any of them is down.

func (*ClientWrapper) Replace

func (cw *ClientWrapper) Replace(item *memcache.Item) error

Replace writes the given item, but only if the server *does* already hold data for this key

func (*ClientWrapper) Set

func (cw *ClientWrapper) Set(item *memcache.Item) error

Set writes the given item, unconditionally.

func (*ClientWrapper) Touch

func (cw *ClientWrapper) Touch(key string, seconds int32) error

Touch updates the expiry for the given key. The seconds parameter is either a Unix timestamp or, if seconds is less than 1 month, the number of seconds into the future at which time the item will expire. Zero means the item has no expiration time. ErrCacheMiss is returned if the key is not in the cache. The key must be at most 250 bytes in length.

type MockClient

type MockClient struct {
	// contains filtered or unexported fields
}

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Add

func (m *MockClient) Add(item *memcache.Item) error

Add mocks base method.

func (*MockClient) CompareAndSwap

func (m *MockClient) CompareAndSwap(item *memcache.Item) error

CompareAndSwap mocks base method.

func (*MockClient) Decrement

func (m *MockClient) Decrement(key string, delta uint64) (uint64, error)

Decrement mocks base method.

func (*MockClient) Delete

func (m *MockClient) Delete(key string) error

Delete mocks base method.

func (*MockClient) DeleteAll

func (m *MockClient) DeleteAll() error

DeleteAll mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) FlushAll

func (m *MockClient) FlushAll() error

FlushAll mocks base method.

func (*MockClient) Get

func (m *MockClient) Get(key string) (*memcache.Item, error)

Get mocks base method.

func (*MockClient) GetMulti

func (m *MockClient) GetMulti(keys []string) (map[string]*memcache.Item, error)

GetMulti mocks base method.

func (*MockClient) Increment

func (m *MockClient) Increment(key string, delta uint64) (uint64, error)

Increment mocks base method.

func (*MockClient) Ping

func (m *MockClient) Ping() error

Ping mocks base method.

func (*MockClient) Replace

func (m *MockClient) Replace(item *memcache.Item) error

Replace mocks base method.

func (*MockClient) Set

func (m *MockClient) Set(item *memcache.Item) error

Set mocks base method.

func (*MockClient) Touch

func (m *MockClient) Touch(key string, seconds int32) error

Touch mocks base method.

type MockClientMockRecorder

type MockClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Add

func (mr *MockClientMockRecorder) Add(item interface{}) *gomock.Call

Add indicates an expected call of Add.

func (*MockClientMockRecorder) CompareAndSwap

func (mr *MockClientMockRecorder) CompareAndSwap(item interface{}) *gomock.Call

CompareAndSwap indicates an expected call of CompareAndSwap.

func (*MockClientMockRecorder) Decrement

func (mr *MockClientMockRecorder) Decrement(key, delta interface{}) *gomock.Call

Decrement indicates an expected call of Decrement.

func (*MockClientMockRecorder) Delete

func (mr *MockClientMockRecorder) Delete(key interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockClientMockRecorder) DeleteAll

func (mr *MockClientMockRecorder) DeleteAll() *gomock.Call

DeleteAll indicates an expected call of DeleteAll.

func (*MockClientMockRecorder) FlushAll

func (mr *MockClientMockRecorder) FlushAll() *gomock.Call

FlushAll indicates an expected call of FlushAll.

func (*MockClientMockRecorder) Get

func (mr *MockClientMockRecorder) Get(key interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockClientMockRecorder) GetMulti

func (mr *MockClientMockRecorder) GetMulti(keys interface{}) *gomock.Call

GetMulti indicates an expected call of GetMulti.

func (*MockClientMockRecorder) Increment

func (mr *MockClientMockRecorder) Increment(key, delta interface{}) *gomock.Call

Increment indicates an expected call of Increment.

func (*MockClientMockRecorder) Ping

func (mr *MockClientMockRecorder) Ping() *gomock.Call

Ping indicates an expected call of Ping.

func (*MockClientMockRecorder) Replace

func (mr *MockClientMockRecorder) Replace(item interface{}) *gomock.Call

Replace indicates an expected call of Replace.

func (*MockClientMockRecorder) Set

func (mr *MockClientMockRecorder) Set(item interface{}) *gomock.Call

Set indicates an expected call of Set.

func (*MockClientMockRecorder) Touch

func (mr *MockClientMockRecorder) Touch(key, seconds interface{}) *gomock.Call

Touch indicates an expected call of Touch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL