-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.go
78 lines (61 loc) · 1.15 KB
/
init.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
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
package cachify
import (
"time"
)
func NewEntries() *entries {
return &entries{}
}
func NewState() *state {
return &state{
accessTime: time.Now(),
}
}
func (c *entries) WithKey(value string) *entries {
c.key = value
return c
}
func (c *entries) WithValue(value interface{}) *entries {
c.value = value
return c
}
func (c *entries) WithExpiration(value time.Time) *entries {
c.expiration = value
return c
}
func (c *entries) Key() string {
return c.key
}
func (c *entries) Value() interface{} {
return c.value
}
func (c *entries) Expiration() time.Time {
return c.expiration
}
func (l *state) WithKey(value string) *state {
l.key = value
return l
}
func (l *state) WithValue(value interface{}) *state {
l.value = value
return l
}
func (l *state) WithAccessTime(value time.Time) *state {
l.accessTime = value
return l
}
func (l *state) WithExpiration(value time.Time) *state {
l.expiration = value
return l
}
func (l *state) Key() string {
return l.key
}
func (l *state) Value() interface{} {
return l.value
}
func (l *state) Expiration() time.Time {
return l.expiration
}
func (l *state) AccessTime() time.Time {
return l.accessTime
}