Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
observer.Observer
Entry(key string) (*Entry, fail.Error) // returns a cache entry from its key
Reserve(key string, timeout time.Duration) fail.Error // reserve an entry in the cache
Commit(key string, content Cacheable) (*Entry, fail.Error) // Commit fills a previously reserved entry by 'key' with 'content'
Free(key string) fail.Error // frees a cache entry (removing the reservation from cache)
Add(content Cacheable) (*Entry, fail.Error) // adds a content in cache (doing Reserve+Commit in a whole with content ID as key)
}
Cache interface describing what a struct must implement to be considered as a cache
type Cacheable ¶
type Cacheable interface {
observer.Observable
Released() // Tells cache handler the instance is no more used, giving a chance to free this instance from cache
Destroyed() // tells cache handler the instance has been deleted and MUST be removed from cache
}
Cacheable is the interface a struct must satisfy to be able to be cached
type Entry ¶
Entry is a struct containing information about a cache entry
func (*Entry) Content ¶
func (ce *Entry) Content() interface{}
Content returns the content of the cache
func (*Entry) LockContent ¶
LockContent increments the counter of use of cache entry
func (*Entry) UnlockContent ¶
UnlockContent decrements the counter of use of cache entry
Click to show internal directories.
Click to hide internal directories.