File tree 3 files changed +5
-5
lines changed
3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -123,13 +123,13 @@ func New(config ...Config) fiber.Handler {
123
123
}
124
124
125
125
// Check if entry is expired
126
- if e .exp != 0 && ts >= e .exp {
126
+ if e != nil && e .exp != 0 && ts >= e .exp {
127
127
deleteKey (key )
128
128
if cfg .MaxBytes > 0 {
129
129
_ , size := heap .remove (e .heapidx )
130
130
storedBytes -= size
131
131
}
132
- } else if e .exp != 0 && ! hasRequestDirective (c , noCache ) {
132
+ } else if e != nil && e .exp != 0 && ! hasRequestDirective (c , noCache ) {
133
133
// Separate body value to avoid msgp serialization
134
134
// We can store raw bytes with Storage 👍
135
135
if cfg .Storage != nil {
@@ -193,6 +193,7 @@ func New(config ...Config) fiber.Handler {
193
193
}
194
194
}
195
195
196
+ e = manager .acquire ()
196
197
// Cache response
197
198
e .body = utils .CopyBytes (c .Response ().Body ())
198
199
e .status = c .Response ().StatusCode ()
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ type heapEntry struct {
15
15
// elements in constant time. It does so by handing out special indices
16
16
// and tracking entry movement.
17
17
//
18
- // indexdedHeap is used for quickly finding entries with the lowest
18
+ // indexedHeap is used for quickly finding entries with the lowest
19
19
// expiration timestamp and deleting arbitrary entries.
20
20
type indexedHeap struct {
21
21
// Slice the heap is built on
Original file line number Diff line number Diff line change @@ -83,8 +83,7 @@ func (m *manager) get(key string) *item {
83
83
return it
84
84
}
85
85
if it , _ = m .memory .Get (key ).(* item ); it == nil { //nolint:errcheck // We store nothing else in the pool
86
- it = m .acquire ()
87
- return it
86
+ return nil
88
87
}
89
88
return it
90
89
}
You can’t perform that action at this time.
0 commit comments