diff options
author | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-03-03 17:24:17 +0530 |
---|---|---|
committer | Marc Pervaz Boocha <marcpervaz@qburst.com> | 2025-03-03 17:24:17 +0530 |
commit | 7f9a513ea1803af327067b7bd84326c63b3d3844 (patch) | |
tree | d0fd50db0aa8d4d59a79c22fc9eb9b84e305a261 /evict.go | |
parent | Improved Concurency (diff) | |
download | cache-7f9a513ea1803af327067b7bd84326c63b3d3844.tar cache-7f9a513ea1803af327067b7bd84326c63b3d3844.tar.gz cache-7f9a513ea1803af327067b7bd84326c63b3d3844.tar.bz2 cache-7f9a513ea1803af327067b7bd84326c63b3d3844.tar.lz cache-7f9a513ea1803af327067b7bd84326c63b3d3844.tar.xz cache-7f9a513ea1803af327067b7bd84326c63b3d3844.tar.zst cache-7f9a513ea1803af327067b7bd84326c63b3d3844.zip |
Added documentation and tests
Diffstat (limited to '')
-rw-r--r-- | evict.go | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -41,6 +41,8 @@ func pushEvict(node *node, sentinnel *node) { node.EvictPrev.EvictNext = node } +var ErrInvalidPolicy = errors.New("invalid policy") + // SetPolicy sets the eviction policy based on the given type. func (e *evictionPolicy) SetPolicy(y EvictionPolicyType) error { store := map[EvictionPolicyType]func() evictionStrategies{ @@ -63,7 +65,7 @@ func (e *evictionPolicy) SetPolicy(y EvictionPolicyType) error { factory, ok := store[y] if !ok { - return errors.New("invalid policy") + return ErrInvalidPolicy } e.evictionStrategies = factory() |