Documentation ¶
Overview ¶
Package fakecacheservice provides a fake implementation of cacheservice.CacheService
Index ¶
- type Cache
- type FakeCacheService
- func (service *FakeCacheService) Add(key string, flags uint16, timeout uint64, value []byte) (bool, error)
- func (service *FakeCacheService) Append(key string, flags uint16, timeout uint64, value []byte) (bool, error)
- func (service *FakeCacheService) Cas(key string, flags uint16, timeout uint64, value []byte, cas uint64) (bool, error)
- func (service *FakeCacheService) Close()
- func (service *FakeCacheService) Delete(key string) (bool, error)
- func (service *FakeCacheService) FlushAll() error
- func (service *FakeCacheService) Get(keys ...string) ([]cs.Result, error)
- func (service *FakeCacheService) Gets(keys ...string) ([]cs.Result, error)
- func (service *FakeCacheService) Prepend(key string, flags uint16, timeout uint64, value []byte) (bool, error)
- func (service *FakeCacheService) Replace(key string, flags uint16, timeout uint64, value []byte) (bool, error)
- func (service *FakeCacheService) Set(key string, flags uint16, timeout uint64, value []byte) (bool, error)
- func (service *FakeCacheService) Stats(key string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a cache like data structure.
func Register ¶
func Register() *Cache
Register registers a fake implementation of cacheservice.CacaheService and returns its registered name
func (*Cache) DisableCacheServiceError ¶
func (cache *Cache) DisableCacheServiceError()
DisableCacheServiceError makes cache service back to normal.
func (*Cache) EnableCacheServiceError ¶
func (cache *Cache) EnableCacheServiceError()
EnableCacheServiceError makes cache service return error.
type FakeCacheService ¶
type FakeCacheService struct {
// contains filtered or unexported fields
}
FakeCacheService is a fake implementation of CacheService
func NewFakeCacheService ¶
func NewFakeCacheService(cache *Cache) *FakeCacheService
NewFakeCacheService creates a FakeCacheService
func (*FakeCacheService) Add ¶
func (service *FakeCacheService) Add(key string, flags uint16, timeout uint64, value []byte) (bool, error)
Add store the value only if it does not already exist.
func (*FakeCacheService) Append ¶
func (service *FakeCacheService) Append(key string, flags uint16, timeout uint64, value []byte) (bool, error)
Append appends the value after the last bytes in an existing item.
func (*FakeCacheService) Cas ¶
func (service *FakeCacheService) Cas(key string, flags uint16, timeout uint64, value []byte, cas uint64) (bool, error)
Cas stores the value only if no one else has updated the data since you read it last.
func (*FakeCacheService) Close ¶
func (service *FakeCacheService) Close()
Close closes the CacheService
func (*FakeCacheService) Delete ¶
func (service *FakeCacheService) Delete(key string) (bool, error)
Delete delete the value for the specified cache key.
func (*FakeCacheService) FlushAll ¶
func (service *FakeCacheService) FlushAll() error
FlushAll purges the entire cache.
func (*FakeCacheService) Get ¶
func (service *FakeCacheService) Get(keys ...string) ([]cs.Result, error)
Get returns cached data for given keys.
func (*FakeCacheService) Gets ¶
func (service *FakeCacheService) Gets(keys ...string) ([]cs.Result, error)
Gets returns cached data for given keys, it is an alternative Get api for using with CAS. Gets returns a CAS identifier with the item. If the item's CAS value has changed since you Gets'ed it, it will not be stored.
func (*FakeCacheService) Prepend ¶
func (service *FakeCacheService) Prepend(key string, flags uint16, timeout uint64, value []byte) (bool, error)
Prepend prepends the value before existing value.
func (*FakeCacheService) Replace ¶
func (service *FakeCacheService) Replace(key string, flags uint16, timeout uint64, value []byte) (bool, error)
Replace replaces the value, only if the value already exists, for the specified cache key.