Documentation ¶
Index ¶
- Constants
- type Cache
- func (Cache *Cache) Add(key string, content interface{}, expirationTime time.Duration) error
- func (Cache *Cache) Delete(key string) error
- func (Cache *Cache) Flush()
- func (Cache *Cache) Get(key string) (interface{}, bool)
- func (Cache *Cache) GetWithExpiration(key string) (interface{}, time.Time, bool)
- func (Cache *Cache) Length() int
- func (Cache *Cache) Set(key string, content interface{}, expirationTime time.Duration)
- type ShardedCache
- func (shardedCache *ShardedCache) Add(key string, content interface{}, expirationTime time.Duration) error
- func (shardedCache *ShardedCache) Delete(key string) error
- func (shardedCache *ShardedCache) Flush()
- func (shardedCache *ShardedCache) Get(key string) (interface{}, bool)
- func (shardedCache *ShardedCache) GetWithExpiration(key string) (interface{}, time.Time, bool)
- func (shardedCache *ShardedCache) Set(key string, content interface{}, expirationTime time.Duration)
Constants ¶
View Source
const ( DefaultExpirationTime time.Duration = 0 NoExpirationTime time.Duration = -1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶ added in v1.0.6
type Cache struct {
// contains filtered or unexported fields
}
func (*Cache) Add ¶ added in v1.0.6
Tries to add a key/entry into the Cache. If the Cache already has that key it will throw an error. If you'd like to add (or "update") a value even if its key exists, use the Set method
func (*Cache) Get ¶ added in v1.0.6
Returns the entry from the Cache from given key, and a bool if it was found or not. If the key has no object associated with it, or wasn't found, returns nil.
func (*Cache) GetWithExpiration ¶ added in v1.0.6
Returns the entry from the Cache with given key, the time of the expiration, and bool if it was found or not. If the key has no object associated with it, or wasn't found, returns nil.
type ShardedCache ¶ added in v1.0.5
type ShardedCache struct {
// contains filtered or unexported fields
}
func NewShardedCache ¶ added in v1.0.5
func (*ShardedCache) Add ¶ added in v1.0.5
func (shardedCache *ShardedCache) Add(key string, content interface{}, expirationTime time.Duration) error
func (*ShardedCache) Delete ¶ added in v1.0.5
func (shardedCache *ShardedCache) Delete(key string) error
func (*ShardedCache) Flush ¶ added in v1.0.5
func (shardedCache *ShardedCache) Flush()
func (*ShardedCache) Get ¶ added in v1.0.5
func (shardedCache *ShardedCache) Get(key string) (interface{}, bool)
func (*ShardedCache) GetWithExpiration ¶ added in v1.0.5
func (shardedCache *ShardedCache) GetWithExpiration(key string) (interface{}, time.Time, bool)
Click to show internal directories.
Click to hide internal directories.