fixup! fixup! Further pursue of perfection.

This commit is contained in:
2025-09-05 00:22:13 +01:00
parent f291dcca26
commit 2c902eaafb
11 changed files with 238 additions and 63 deletions
+8
View File
@@ -144,9 +144,17 @@ func (c *Cache) Delete(key string) {
// This method is called automatically by the background cleanup task but can also
// be called manually for immediate cleanup of expired entries.
func (c *Cache) Cleanup() {
if c == nil {
return
}
c.mutex.Lock()
defer c.mutex.Unlock()
if c.items == nil {
return
}
now := time.Now()
for key, item := range c.items {
if now.After(item.ExpiresAt) {