-
Notifications
You must be signed in to change notification settings - Fork 2
/
option.go
40 lines (34 loc) · 823 Bytes
/
option.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
36
37
38
39
40
package gdcache
// Options Optional
type Options struct {
cacheTagName string
log Logger
serializer Serializer
serviceName string
}
// OptionsFunc Alternative method
type OptionsFunc func(o *Options)
// WithServiceName Service Name
func WithServiceName(serviceName string) OptionsFunc {
return func(o *Options) {
o.serviceName = serviceName
}
}
// WithCacheTagName Specify cache tag name
func WithCacheTagName(cacheTagName string) OptionsFunc {
return func(o *Options) {
o.cacheTagName = cacheTagName
}
}
// WithLogger Specify log
func WithLogger(logger Logger) OptionsFunc {
return func(o *Options) {
o.log = logger
}
}
// WithSerializer Specify the serialization method
func WithSerializer(serializer Serializer) OptionsFunc {
return func(o *Options) {
o.serializer = serializer
}
}