Documentation
¶
Index ¶
- type Cache
- type Cacheable
- type KVCache
- func (c *KVCache) Drop(ids ...string) error
- func (c *KVCache) Flush() error
- func (c *KVCache) Get(id string, out interface{}) bool
- func (c *KVCache) Reset()
- func (c *KVCache) Set(element Cacheable) error
- func (c *KVCache) SetRaw(id string, element interface{}) error
- func (c *KVCache) Store() map[string]interface{}
- type ThreadSafeCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // GetLocal returns the object in local cache, if it exists. // Returns true if found, false if not found Get(id string, out interface{}) bool // Set both remote and local caches Set(element Cacheable) error // SetRaw lets you choose the id instead of relying on the Cacheable interface SetRaw(id string, element interface{}) error // Drop both remote and local cache entry Drop(ids ...string) error // Flush removes all entries in remote and local cache Flush() error }
Cache unifies cache usage across the project.
func NewKV ¶
func NewKV() Cache
NewKV is a local Key: Value storage using a stock golang map[string]interface{}. Very useful for tests but could be used for any local cache.
func NewThreadSafeCache ¶
NewThreadSafeCache creates the wrapped cache
type Cacheable ¶
type Cacheable interface {
CacheID() string
}
Cacheable makes your struct cache-able
type KVCache ¶
type KVCache struct {
// contains filtered or unexported fields
}
KVCache is a simple map[string]interface{} so you get a very simple local key:value storage.
type ThreadSafeCache ¶
type ThreadSafeCache struct {
// contains filtered or unexported fields
}
ThreadSafeCache wrap Cache with locks
func (*ThreadSafeCache) Get ¶
func (tsc *ThreadSafeCache) Get(id string, out interface{}) bool
Get ...
func (*ThreadSafeCache) SetRaw ¶
func (tsc *ThreadSafeCache) SetRaw(id string, element interface{}) error
SetRaw ...
Click to show internal directories.
Click to hide internal directories.