-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcache_options.go
More file actions
80 lines (70 loc) · 2.07 KB
/
cache_options.go
File metadata and controls
80 lines (70 loc) · 2.07 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package atomiccache
// Options are used for AtomicCache construct function.
type Options struct {
// Size of byte array used for memory allocation at small shard section.
RecordSizeSmall int
// Size of byte array used for memory allocation at medium shard section.
RecordSizeMedium int
// Size of byte array used for memory allocation at large shard section.
RecordSizeLarge int
// Maximum records per shard.
MaxRecords int
// Maximum small shards which can be allocated in cache memory.
MaxShardsSmall int
// Maximum medium shards which can be allocated in cache memory.
MaxShardsMedium int
// Maximum large shards which can be allocated in cache memory.
MaxShardsLarge int
// Garbage collector starter (run garbage collection every X sets).
GcStarter uint32
}
// Option specification for Printer package.
type Option func(*Options)
// OptionRecordSizeSmall option specification.
func OptionRecordSizeSmall(option int) Option {
return func(opts *Options) {
opts.RecordSizeSmall = option
}
}
// OptionRecordSizeMedium option specification.
func OptionRecordSizeMedium(option int) Option {
return func(opts *Options) {
opts.RecordSizeMedium = option
}
}
// OptionRecordSizeLarge option specification.
func OptionRecordSizeLarge(option int) Option {
return func(opts *Options) {
opts.RecordSizeLarge = option
}
}
// OptionMaxRecords option specification.
func OptionMaxRecords(option int) Option {
return func(opts *Options) {
opts.MaxRecords = option
}
}
// OptionMaxShardsSmall option specification.
func OptionMaxShardsSmall(option int) Option {
return func(opts *Options) {
opts.MaxShardsSmall = option
}
}
// OptionMaxShardsMedium option specification.
func OptionMaxShardsMedium(option int) Option {
return func(opts *Options) {
opts.MaxShardsMedium = option
}
}
// OptionMaxShardsLarge option specification.
func OptionMaxShardsLarge(option int) Option {
return func(opts *Options) {
opts.MaxShardsLarge = option
}
}
// OptionGcStarter option specification.
func OptionGcStarter(option uint32) Option {
return func(opts *Options) {
opts.GcStarter = option
}
}