mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-30 08:06:40 +02:00
use read lock and unlock instead of write ones (#2410)
Co-authored-by: Amir Khazaie <a.khazaie@digikala.com>
This commit is contained in:
parent
696a0ba714
commit
ef7528ebdb
4
cache/default.go
vendored
4
cache/default.go
vendored
@ -20,8 +20,8 @@ func (c *memCache) Context(ctx context.Context) Cache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *memCache) Get(key string) (interface{}, time.Time, error) {
|
func (c *memCache) Get(key string) (interface{}, time.Time, error) {
|
||||||
c.RWMutex.Lock()
|
c.RWMutex.RLock()
|
||||||
defer c.RWMutex.Unlock()
|
defer c.RWMutex.RUnlock()
|
||||||
|
|
||||||
item, found := c.items[key]
|
item, found := c.items[key]
|
||||||
if !found {
|
if !found {
|
||||||
|
Loading…
Reference in New Issue
Block a user