mirror of
https://github.com/mailgun/groupcache.git
synced 2024-11-16 14:10:04 +00:00
How to make expiration optional.
This commit is contained in:
parent
87609ae02e
commit
33907cd323
11
README.md
11
README.md
@ -25,11 +25,12 @@ For API docs and examples, see http://godoc.org/github.com/mailgun/groupcache
|
||||
cluster eventually becomes consistent again.
|
||||
|
||||
* Support for expired values. `SetBytes()`, `SetProto()` and `SetString()` now
|
||||
accept an optional `time.Time{}` which represents a time in the future when the
|
||||
value will expire. Expiration is handled by the LRU Cache when a `Get()` on a
|
||||
key is requested. This means no network coordination of expired values is needed.
|
||||
However this does require that time on all nodes in the cluster is synchronized
|
||||
for consistent expiration of values.
|
||||
accept an optional `time.Time` which represents a time in the future when the
|
||||
value will expire. If you don't want expiration, pass the zero value for
|
||||
`time.Time` (for instance, `time.Time{}`). Expiration is handled by the LRU Cache
|
||||
when a `Get()` on a key is requested. This means no network coordination of
|
||||
expired values is needed. However this does require that time on all nodes in the
|
||||
cluster is synchronized for consistent expiration of values.
|
||||
|
||||
* Now always populating the hotcache. A more complex algorithm is unnecessary
|
||||
when the LRU cache will ensure the most used values remain in the cache. The
|
||||
|
4
sinks.go
4
sinks.go
@ -33,6 +33,10 @@ var _ Sink = &byteViewSink{}
|
||||
//
|
||||
// Implementation of Getter must call exactly one of the Set methods
|
||||
// on success.
|
||||
//
|
||||
// `e` sets an optional time in the future when the value will expire.
|
||||
// If you don't want expiration, pass the zero value for
|
||||
// `time.Time` (for instance, `time.Time{}`).
|
||||
type Sink interface {
|
||||
// SetString sets the value to s.
|
||||
SetString(s string, e time.Time) error
|
||||
|
Loading…
Reference in New Issue
Block a user