diff options
author | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-02-26 15:18:02 +0530 |
---|---|---|
committer | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-02-27 13:38:36 +0530 |
commit | 7b6c99bbc293cbf268b7be7f684577dbf668d895 (patch) | |
tree | 2b5c2fee0094b6dc55276186721d2e39a9cc846d /encoding.go | |
parent | Update store to use EvictList instead of Evict (diff) | |
download | cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.tar cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.tar.gz cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.tar.bz2 cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.tar.lz cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.tar.xz cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.tar.zst cache-7b6c99bbc293cbf268b7be7f684577dbf668d895.zip |
Added Memorize and UpdateInPlace
Diffstat (limited to 'encoding.go')
-rw-r--r-- | encoding.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/encoding.go b/encoding.go index 1327087..a4af699 100644 --- a/encoding.go +++ b/encoding.go @@ -81,7 +81,7 @@ func (e *encoder) EncodeStore(s *store) error { return err } - for v := s.Evict.EvictNext; v != &s.Evict; v = v.EvictNext { + for v := s.EvictList.EvictNext; v != &s.EvictList; v = v.EvictNext { if err := e.EncodeNode(v); err != nil { return err } @@ -186,7 +186,9 @@ func (d *decoder) DecodeStore(s *store) error { return err } - s.Policy.SetPolicy(EvictionPolicyType(policy)) + if err := s.Policy.SetPolicy(EvictionPolicyType(policy)); err != nil { + return err + } length, err := d.DecodeUint64() if err != nil { @@ -217,7 +219,7 @@ func (d *decoder) DecodeStore(s *store) error { v.HashNext.HashPrev = v v.HashPrev.HashNext = v - v.EvictNext = &s.Evict + v.EvictNext = &s.EvictList v.EvictPrev = v.EvictNext.EvictPrev v.EvictNext.EvictPrev = v v.EvictPrev.EvictNext = v |