@@ -59,8 +59,6 @@ type memKey struct {
59
59
key [32 ]byte
60
60
}
61
61
62
- const useMemCache = false // disabled for now while we debug the new file-based implementation
63
-
64
62
// Get retrieves from the cache and returns a newly allocated
65
63
// copy of the value most recently supplied to Set(kind, key),
66
64
// possibly by another process.
@@ -69,10 +67,8 @@ func Get(kind string, key [32]byte) ([]byte, error) {
69
67
// First consult the read-through memory cache.
70
68
// Note that memory cache hits do not update the times
71
69
// used for LRU eviction of the file-based cache.
72
- if useMemCache {
73
- if value := memCache .Get (memKey {kind , key }); value != nil {
74
- return value .([]byte ), nil
75
- }
70
+ if value := memCache .Get (memKey {kind , key }); value != nil {
71
+ return value .([]byte ), nil
76
72
}
77
73
78
74
iolimit <- struct {}{} // acquire a token
@@ -130,9 +126,7 @@ func Get(kind string, key [32]byte) ([]byte, error) {
130
126
touch (indexName )
131
127
touch (casName )
132
128
133
- if useMemCache {
134
- memCache .Set (memKey {kind , key }, value , len (value ))
135
- }
129
+ memCache .Set (memKey {kind , key }, value , len (value ))
136
130
137
131
return value , nil
138
132
}
@@ -143,9 +137,7 @@ var ErrNotFound = fmt.Errorf("not found")
143
137
144
138
// Set updates the value in the cache.
145
139
func Set (kind string , key [32 ]byte , value []byte ) error {
146
- if useMemCache {
147
- memCache .Set (memKey {kind , key }, value , len (value ))
148
- }
140
+ memCache .Set (memKey {kind , key }, value , len (value ))
149
141
150
142
iolimit <- struct {}{} // acquire a token
151
143
defer func () { <- iolimit }() // release a token
0 commit comments