2024-05-09 23:26:21 +03:00
|
|
|
package store
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/maypok86/otter"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-05-10 11:46:43 +03:00
|
|
|
cache, err := otter.MustBuilder[int, PollState](10_000).
|
|
|
|
Cost(func(key int, value PollState) uint32 {
|
2024-05-09 23:26:21 +03:00
|
|
|
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
|
|
|
|
}
|