Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is an expiring, stale-checking LRU of keys to multiple values.
type Options ¶
type Options struct { // Expiration will remove any values from the Cache after the // value passes. Zero means no expiration. Expiration time.Duration // Capacity is the maximum number of values the Cache can store. // Zero means unlimited. Negative means no values. Capacity int // KeyCapacity is like Capacity except it is per key. Zero means // the Cache holds unlimited for any single key. Negative means // no values for any single key. // // Implementation note: The cache is potentially quadratic in the // size of this parameter, so it is intended for small values, like // 5 or so. KeyCapacity int // Stale is optionally called on values before they are returned // to see if they should be discarded. Nil means no check is made. Stale func(interface{}) bool // Close is optionally called on any value removed from the Cache. Close func(interface{}) error // Unblocked is optional and called on values before they are returned // to see if they are available to be used. Nil means no check is made. Unblocked func(interface{}) bool }
Options contains the options to configure a cache.
Click to show internal directories.
Click to hide internal directories.