aboutsummaryrefslogtreecommitdiff
path: root/internal/lru/clear.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lru/clear.go')
-rw-r--r--internal/lru/clear.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/lru/clear.go b/internal/lru/clear.go
new file mode 100644
index 00000000..42f9c50e
--- /dev/null
+++ b/internal/lru/clear.go
@@ -0,0 +1,10 @@
+package lru
+
+// Clear removes all entries from the cache.
+func (cache *Cache[K, V]) Clear() {
+ for elem := cache.lru.Front(); elem != nil; {
+ next := elem.Next()
+ cache.removeElem(elem)
+ elem = next
+ }
+}