Documentation ¶
Overview ¶
Package expiremap is a simple thread-safe cache like sync.Map. Value in this map will automatically be deleted after expiration time.
This package acts like go-cache(github.com/patrickmn/go-cache), but much faster. The limitations are: expiration could not changed once the map is established, and the actual expiration time for each value may have an error of up to one second. These are the cost of increased effenciency.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is the main instance of this package.
func New ¶
New initialize and return an expiremap instance with given expiration for each element.
The exact expiration time for each element may have up to one second longer because the map checks expiration every one second.
func (*Map) Expiration ¶
Expiration returns the expiration time for each values in this map.