-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.go
35 lines (29 loc) · 1002 Bytes
/
model.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
34
35
package caching
import (
"time"
"github.com/allegro/bigcache/v2"
)
// Config model for database caching config
type Config struct {
CustomCache CustomCache `json:"customCache,omitempty"`
Redis Redis `json:"redis,omitempty"`
BigCache bigcache.Config `json:"bigCache,omitempty"`
}
// Redis model for redis config
type Redis struct {
Password string `json:"password,omitempty"`
Host string `json:"host,omitempty"`
DB int `json:"db,omitempty"`
MaxRetries int `json:"maxRetries,omitempty"`
}
// CustomCache config model
type CustomCache struct {
CacheSize int64 `json:"cacheSize,omitempty"` // byte
CleaningEnable bool `json:"cleaningEnable,omitempty"`
CleaningInterval time.Duration `json:"cleaningInterval,omitempty"` // nanosecond
}
// customCacheItem private model for custom cache record
type customCacheItem struct {
data interface{} `json:"data,omitempty"`
expires int64 `json:"expires,omitempty"`
}