-
-
Notifications
You must be signed in to change notification settings - Fork 192
/
options.go
33 lines (26 loc) · 785 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package store
import (
"time"
)
// Options represents the cache store available options
type Options struct {
// Cost corresponds to the memory capacity used by the item when setting a value
// Actually it seems to be used by Ristretto library only
Cost int64
// Expiration allows to specify an expiration time when setting a value
Expiration time.Duration
// Tags allows to specify associated tags to the current value
Tags []string
}
// CostValue returns the allocated memory capacity
func (o Options) CostValue() int64 {
return o.Cost
}
// ExpirationValue returns the expiration option value
func (o Options) ExpirationValue() time.Duration {
return o.Expiration
}
// TagsValue returns the tags option value
func (o Options) TagsValue() []string {
return o.Tags
}