1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-30 22:33:49 +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:
Amir Khazaie
2022-01-09 13:50:08 +03:30
committed by GitHub
parent 696a0ba714
commit ef7528ebdb

4
cache/default.go vendored
View File

@ -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 {