aboutsummaryrefslogtreecommitdiffstats
path: root/store.go
diff options
context:
space:
mode:
authorMarc Pervaz Boocha <marcpervaz@qburst.com>2025-03-03 11:22:32 +0530
committerMarc Pervaz Boocha <marcpervaz@qburst.com>2025-03-03 11:22:32 +0530
commitce850da379785f471109a6d2ba4e34eee7a15eed (patch)
tree50632fb938d19164d5bcdef7564fe83d508a6736 /store.go
parentImproved Concurency Part1 (diff)
downloadcache-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 'store.go')
-rw-r--r--store.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/store.go b/store.go
index 366bbd3..20241ac 100644
--- a/store.go
+++ b/store.go
@@ -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 {