-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathoptions.go
35 lines (31 loc) · 1 KB
/
options.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
// Copyright (c) 2022 Dmitry Tkachenko ([email protected])
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package care
// Options - memoization options. There are some options you can redefine
// by your own implementation in order to have more flexibility.
// 'Options' gives enough room space to do that.
type Options struct {
// The memoization feature is turned on/off.
Switch Switch
// A pool of methods for memorizing responses.
Methods Methods
// Header filter for including the ones in the key computation.
MetaFilter MetaFilter
// Used for the key computation.
Hash Hash
// A cache
Cache Cache
}
// NewOptions - makes a default options set, having filled
// all items by thread-safe implementations.
func NewOptions() *Options {
opts := Options{
Switch: newSwitch(),
Methods: newMethodsStorage(),
MetaFilter: NewZeroMetaFilter(true),
Hash: newDefaultHash(),
Cache: NewInMemoryCache(1024),
}
return &opts
}