File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 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) {
129129func (c * LRU ) Peek (key interface {}) (value interface {}, isFound bool ) {
130130 var ent * list.Element
131131 if ent , isFound = c .items [key ]; isFound {
132- return ent .Value .(* entry ).value , true
132+ return ent .Value .(* entry ).value , isFound
133133 }
134134 return nil , isFound
135135}
136136
137137// Remove removes the provided key from the cache, returning if the
138138// key was contained.
139139func (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 {
141142 c .removeElement (ent )
142- return true
143+ return
143144 }
144- return false
145+ return
145146}
146147
147148// 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 {
115115
116116func (c * baseTrafficShapingController ) performCheckingForConcurrencyMetric (arg interface {}) * base.TokenResult {
117117 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 )
121120 if concurrencyPtr == nil {
122121 // First to access this arg
123122 return nil
You can’t perform that action at this time.
0 commit comments