File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -289,8 +289,12 @@ func Set(key string, val interface{}) {
289
289
290
290
// Delete deletes value from Gache using key
291
291
func (g * gache ) Delete (key string ) {
292
- atomic .StoreUint64 (& g .l , atomic .LoadUint64 (& g .l )- 1 )
293
- g .shards [xxhash .Sum64 (* (* []byte )(unsafe .Pointer (& key )))& mask ].Delete (key )
292
+ for {
293
+ if v := atomic .LoadUint64 ((* uint64 )(& g .l )); atomic .CompareAndSwapUint64 ((* uint64 )(& g .l ), v , v - 1 ) {
294
+ g .shards [xxhash .Sum64 (* (* []byte )(unsafe .Pointer (& key )))& mask ].Delete (key )
295
+ return
296
+ }
297
+ }
294
298
}
295
299
296
300
// Delete deletes value from Gache using key
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ require (
12
12
github.com/kpango/fastime v1.0.8
13
13
github.com/kpango/glg v1.3.0
14
14
github.com/patrickmn/go-cache v2.1.0+incompatible
15
- github.com/pierrec/lz4 v2.0.5+incompatible
16
15
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6
17
16
google.golang.org/appengine v1.5.0 // indirect
18
17
)
Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ github.com/kpango/glg v1.3.0 h1:77BWdR0kKkFloM2eSAr0A7lWvUyAIlOhj4LV5n2hrB8=
29
29
github.com/kpango/glg v1.3.0 /go.mod h1:7zzaAoMqvngad+sagWLjr00EQMJaqyGONdg0WYBAO3M =
30
30
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc =
31
31
github.com/patrickmn/go-cache v2.1.0+incompatible /go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ =
32
- github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I =
33
- github.com/pierrec/lz4 v2.0.5+incompatible /go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY =
34
32
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 /go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA =
35
33
github.com/vmihailenco/msgpack v4.0.1+incompatible h1:RMF1enSPeKTlXrXdOcqjFUElywVZjjC6pqse21bKbEU =
36
34
github.com/vmihailenco/msgpack v4.0.1+incompatible /go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk =
You can’t perform that action at this time.
0 commit comments