diff options
author | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-02-28 18:09:36 +0530 |
---|---|---|
committer | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-02-28 18:09:36 +0530 |
commit | a04c538db5df71fb8effb971cc9f9e3cc77ce3af (patch) | |
tree | f31d4f448a5b64a95e38915c8f4db3fcdad41585 /encoding.go | |
parent | Resizing imporvements and typo fixes (diff) | |
download | cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.tar cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.tar.gz cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.tar.bz2 cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.tar.lz cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.tar.xz cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.tar.zst cache-a04c538db5df71fb8effb971cc9f9e3cc77ce3af.zip |
Improved Concurency Part1
Diffstat (limited to 'encoding.go')
-rw-r--r-- | encoding.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/encoding.go b/encoding.go index 343e345..fe376b2 100644 --- a/encoding.go +++ b/encoding.go @@ -224,15 +224,15 @@ func (d *decoder) DecodeStore(s *store) error { v.EvictNext.EvictPrev = v v.EvictPrev.EvictNext = v - s.Cost = s.Cost + uint64(len(v.Key)) + uint64(len(v.Value)) + s.Cost = s.Cost + v.Cost() } return nil } func (s *store) Snapshot(w io.WriteSeeker) error { - s.mu.Lock() - defer s.mu.Unlock() + s.Lock.Lock() + defer s.Lock.Unlock() if _, err := w.Seek(0, io.SeekStart); err != nil { return err |