fakecacheservice

package
v2.0.0-alpha2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package fakecacheservice provides a fake implementation of cacheservice.CacheService

Index

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) Clear

func (cache *Cache) Clear()

Clear empties the cache.

func (*Cache) Delete

func (cache *Cache) Delete(key string)

Delete deletes the given key from the cache.

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.

func (*Cache) Get

func (cache *Cache) Get(key string) (*cs.Result, bool)

Get gets the value from cache given the key.

func (*Cache) Set

func (cache *Cache) Set(key string, val *cs.Result)

Set sets a key and associated value to the cache.

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.

func (*FakeCacheService) Set

func (service *FakeCacheService) Set(key string, flags uint16, timeout uint64, value []byte) (bool, error)

Set set the value with specified cache key.

func (*FakeCacheService) Stats

func (service *FakeCacheService) Stats(key string) ([]byte, error)

Stats returns a list of basic stats.

Jump to

Keyboard shortcuts

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