31 lines
543 B
Go
31 lines
543 B
Go
|
package store
|
||
|
|
||
|
import (
|
||
|
"github.com/maypok86/otter"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
cache, err := otter.MustBuilder[int64, PollState](10_000).
|
||
|
Cost(func(key int64, value PollState) uint32 {
|
||
|
return 1
|
||
|
}).
|
||
|
WithTTL(time.Hour * 24 * 7).
|
||
|
Build()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
Polls = cache
|
||
|
|
||
|
redmineSetups, err := otter.MustBuilder[int64, *RedmineSetup](1000).
|
||
|
Cost(func(key int64, value *RedmineSetup) uint32 {
|
||
|
return 1
|
||
|
}).
|
||
|
WithTTL(time.Hour * 24 * 7).
|
||
|
Build()
|
||
|
if err != nil {
|
||
|
panic(err)
|
||
|
}
|
||
|
RedmineSetups = redmineSetups
|
||
|
}
|