1
0
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:
Amir Khazaie 2022-01-09 13:50:08 +03:30 committed by GitHub
parent 696a0ba714
commit ef7528ebdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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 {