File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,20 @@ func (c *LRU) Contains(key interface{}) (ok bool) {
129
129
func (c * LRU ) Peek (key interface {}) (value interface {}, isFound bool ) {
130
130
var ent * list.Element
131
131
if ent , isFound = c .items [key ]; isFound {
132
- return ent .Value .(* entry ).value , true
132
+ return ent .Value .(* entry ).value , isFound
133
133
}
134
134
return nil , isFound
135
135
}
136
136
137
137
// Remove removes the provided key from the cache, returning if the
138
138
// key was contained.
139
139
func (c * LRU ) Remove (key interface {}) (isFound bool ) {
140
- if ent , ok := c .items [key ]; ok {
140
+ var ent * list.Element
141
+ if ent , isFound = c .items [key ]; isFound {
141
142
c .removeElement (ent )
142
- return true
143
+ return
143
144
}
144
- return false
145
+ return
145
146
}
146
147
147
148
// RemoveOldest removes the oldest item from the cache.
Original file line number Diff line number Diff line change @@ -115,9 +115,8 @@ func (c *baseTrafficShapingController) BoundMetric() *ParamsMetric {
115
115
116
116
func (c * baseTrafficShapingController ) performCheckingForConcurrencyMetric (arg interface {}) * base.TokenResult {
117
117
specificItem := c .specificItems
118
- initConcurrency := new (int64 )
119
- * initConcurrency = 0
120
- concurrencyPtr := c .metric .ConcurrencyCounter .AddIfAbsent (arg , initConcurrency )
118
+ initConcurrency := int64 (0 )
119
+ concurrencyPtr := c .metric .ConcurrencyCounter .AddIfAbsent (arg , & initConcurrency )
121
120
if concurrencyPtr == nil {
122
121
// First to access this arg
123
122
return nil
You can’t perform that action at this time.
0 commit comments