OSDN Git Service
(root)
/
bytom
/
vapor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c84ab69
)
fix lru issue (#230)
author
Paladz
<yzhu101@uottawa.ca>
Thu, 27 Jun 2019 12:32:56 +0000
(20:32 +0800)
committer
GitHub
<noreply@github.com>
Thu, 27 Jun 2019 12:32:56 +0000
(20:32 +0800)
common/concurrent_lru.go
patch
|
blob
|
history
diff --git
a/common/concurrent_lru.go
b/common/concurrent_lru.go
index
8e9a344
..
68e6e5e
100644
(file)
--- a/
common/concurrent_lru.go
+++ b/
common/concurrent_lru.go
@@
-8,7
+8,7
@@
import (
// Cache is an LRU cache. It is safe for concurrent access.
type Cache struct {
- cache
*lru.Cache
+ cache *lru.Cache
sync.RWMutex
}
@@
-28,8
+28,8
@@
func (c *Cache) Add(key, value interface{}) {
// Get looks up a key's value from the cache.
func (c *Cache) Get(key interface{}) (value interface{}, ok bool) {
- c.
R
Lock()
- defer c.
R
Unlock()
+ c.Lock()
+ defer c.Unlock()
return c.cache.Get(key)
}