diff options
author | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-03-03 11:22:32 +0530 |
---|---|---|
committer | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-03-03 11:22:32 +0530 |
commit | ce850da379785f471109a6d2ba4e34eee7a15eed (patch) | |
tree | 50632fb938d19164d5bcdef7564fe83d508a6736 /store.go | |
parent | Improved Concurency Part1 (diff) | |
download | cache-ce850da379785f471109a6d2ba4e34eee7a15eed.tar cache-ce850da379785f471109a6d2ba4e34eee7a15eed.tar.gz cache-ce850da379785f471109a6d2ba4e34eee7a15eed.tar.bz2 cache-ce850da379785f471109a6d2ba4e34eee7a15eed.tar.lz cache-ce850da379785f471109a6d2ba4e34eee7a15eed.tar.xz cache-ce850da379785f471109a6d2ba4e34eee7a15eed.tar.zst cache-ce850da379785f471109a6d2ba4e34eee7a15eed.zip |
Improved Concurency
Diffstat (limited to '')
-rw-r--r-- | store.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -136,8 +136,8 @@ func (s *store) lookup(key []byte) (*node, uint64, uint64) { // Get retrieves a value from the store by key with locking. func (s *store) Get(key []byte) ([]byte, time.Duration, bool) { - s.Lock.Lock() - defer s.Lock.Unlock() + s.Lock.RLock() + defer s.Lock.RUnlock() v, _, _ := s.lookup(key) if v != nil { |