Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // The internal garbage collector interval. GcInterval = time.Second * 3 // Now is used to retrieve the current local time. Now = time.Now // NewTicker is used to create new ticker. NewTicker = newTicker )
Functions ¶
This section is empty.
Types ¶
type ExpiryFunc ¶
type ExpiryFunc func(key interface{})
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a concurrent map with expiring keys.
func NewMap ¶
func NewMap(f ExpiryFunc) *Map
NewMap creates a new Map and starts the internal garbage collector. When f is not nil, it will be called on expired keys at the end of GC run.
func (*Map) Keys ¶
func (m *Map) Keys() (ret []interface{})
Keys returns slice of map keys in no specified order.
func (*Map) Load ¶
Load returns the value stored in the map for a key, or nil if no value is present. The ok result indicates whether value was found in the map.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func NewSet ¶
func NewSet(f ExpiryFunc) *Set
NewSet creates a new Sap and starts the internal garbage collector. When f is not nil, it will be called on expired values at the end of GC run.
Click to show internal directories.
Click to hide internal directories.