Documentation ¶
Index ¶
- func CreateTopic(topic string) (notification.PubSub, error)
- func CreateTopicWithInitData(topic string, initData interface{}) (notification.PubSub, error)
- func GetPubSub(topic string) (notification.PubSub, error)
- func RemoveTopic(topic string) error
- func SetCache(c Cache)
- type Cache
- type GetItem
- type Item
- type MockCache
- func (m MockCache) Delete(_ string) error
- func (m MockCache) DeleteBySecondaryKey(_ string) error
- func (m MockCache) DeleteForeignKey(_ string) error
- func (m MockCache) DeleteItemsByForeignKey(_ string) error
- func (m MockCache) DeleteSecondaryKey(_ string) error
- func (m MockCache) Flush()
- func (m MockCache) Get(_ string) (interface{}, error)
- func (m MockCache) GetBySecondaryKey(_ string) (interface{}, error)
- func (m MockCache) GetForeignKeys() []string
- func (m MockCache) GetItem(_ string) (*Item, error)
- func (m MockCache) GetItemBySecondaryKey(_ string) (*Item, error)
- func (m MockCache) GetItemsByForeignKey(_ string) ([]*Item, error)
- func (m MockCache) GetKeys() []string
- func (m MockCache) HasItemBySecondaryKeyChanged(_ string, _ interface{}) (bool, error)
- func (m MockCache) HasItemChanged(_ string, _ interface{}) (bool, error)
- func (m MockCache) Load(_ string) error
- func (m MockCache) Save(_ string) error
- func (m MockCache) Set(_ string, _ interface{}) error
- func (m MockCache) SetForeignKey(_ string, _ string) error
- func (m MockCache) SetSecondaryKey(_ string, _ string) error
- func (m MockCache) SetWithForeignKey(_ string, _ string, _ interface{}) error
- func (m MockCache) SetWithSecondaryKey(_ string, _ string, _ interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTopic ¶
func CreateTopic(topic string) (notification.PubSub, error)
CreateTopic - create a new PubSub for a cache item
func CreateTopicWithInitData ¶
func CreateTopicWithInitData(topic string, initData interface{}) (notification.PubSub, error)
CreateTopicWithInitData - create a new PubSub with an item that will be cached, initialize it as well
func GetPubSub ¶
func GetPubSub(topic string) (notification.PubSub, error)
GetPubSub - find a PubSub by topic name
func RemoveTopic ¶
RemoveTopic - removes a PubSub topic and cleans up it's cache
Types ¶
type Cache ¶
type Cache interface { Get(key string) (interface{}, error) GetItem(key string) (*Item, error) GetBySecondaryKey(secondaryKey string) (interface{}, error) GetItemBySecondaryKey(secondaryKey string) (*Item, error) GetForeignKeys() []string GetItemsByForeignKey(foreignKey string) ([]*Item, error) GetKeys() []string HasItemChanged(key string, data interface{}) (bool, error) HasItemBySecondaryKeyChanged(secondaryKey string, data interface{}) (bool, error) Set(key string, data interface{}) error SetWithSecondaryKey(key string, secondaryKey string, data interface{}) error SetWithForeignKey(key string, foreignKey string, data interface{}) error SetSecondaryKey(key string, secondaryKey string) error SetForeignKey(key string, foreignKey string) error Delete(key string) error DeleteBySecondaryKey(secondaryKey string) error DeleteSecondaryKey(secondaryKey string) error DeleteForeignKey(foreignKey string) error DeleteItemsByForeignKey(foreignKey string) error Flush() Save(path string) error Load(path string) error }
Cache - Interface for managing the proxy cache
func LoadFromBuffer ¶
LoadFromBuffer - create a new cache object and loads the data from buffer
type Item ¶
type Item struct { Object interface{} `json:"data"` UpdateTime int64 `json:"updateTime"` Hash uint64 `json:"hash"` SecondaryKeys map[string]bool `json:"secondaryKeys"` // keep track of secondary keys for clean up ForeignKey string `json:"foreignKey"` ContainsPointer bool `json:"containsPointer"` // does item contain a pointer }
Item - a cached item
func (*Item) GetObject ¶
func (i *Item) GetObject() interface{}
GetObject - returns the object saved in this cache item
func (*Item) GetUpdateTime ¶
GetUpdateTime - returns the epoch time that this cache item was updated
type MockCache ¶
type MockCache struct { }
MockCache a mock cache
func (MockCache) DeleteBySecondaryKey ¶
DeleteBySecondaryKey -
func (MockCache) DeleteForeignKey ¶
DeleteForeignKey -
func (MockCache) DeleteItemsByForeignKey ¶
DeleteItemsByForeignKey -
func (MockCache) DeleteSecondaryKey ¶
DeleteSecondaryKey -
func (MockCache) GetBySecondaryKey ¶
GetBySecondaryKey -
func (MockCache) GetItemBySecondaryKey ¶
GetItemBySecondaryKey -
func (MockCache) GetItemsByForeignKey ¶
GetItemsByForeignKey -
func (MockCache) HasItemBySecondaryKeyChanged ¶
HasItemBySecondaryKeyChanged -
func (MockCache) HasItemChanged ¶
HasItemChanged -
func (MockCache) SetForeignKey ¶
SetForeignKey -
func (MockCache) SetSecondaryKey ¶
SetSecondaryKey -
func (MockCache) SetWithForeignKey ¶
SetWithForeignKey -