summaryrefslogtreecommitdiffstats
path: root/encoding.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--encoding.go6
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