github.com/angenalZZZ/gofunc@v0.0.0-20210507121333-48ff1be3917b/data/cache/store/options.go (about) 1 package store 2 3 import ( 4 "time" 5 ) 6 7 // Options represents the cache store available options 8 type Options struct { 9 // Cost corresponds to the memory capacity used by the item when setting a value 10 // Actually it seems to be used by Ristretto library only 11 Cost int64 12 13 // Expiration allows to specify an expiration time when setting a value 14 Expiration time.Duration 15 16 // Tags allows to specify associated tags to the current value 17 Tags []string 18 19 // Async pool invoke 20 Async bool 21 } 22 23 // CostValue returns the allocated memory capacity 24 func (o Options) CostValue() int64 { 25 return o.Cost 26 } 27 28 // ExpirationValue returns the expiration option value 29 func (o Options) ExpirationValue() time.Duration { 30 return o.Expiration 31 } 32 33 // TagsValue returns the tags option value 34 func (o Options) TagsValue() []string { 35 return o.Tags 36 }