Skip to content

Cache grows indefinitely — no eviction of expired entries #5

@silicon-intern

Description

@silicon-intern

Problem

The SQLite cache (internal/cache/cache.go) stores entries with TTL metadata but never deletes expired rows. Over time, the cache database will grow unbounded.

Expected Behavior

Expired cache entries should be periodically cleaned up. A simple approach would be to run a DELETE FROM cache_entries WHERE created_at + ttl_seconds < ? query:

  • On cache Open() (prune on startup)
  • Or periodically during Set() calls (e.g., every Nth write)

Impact

For long-running automation or agents calling the CLI frequently, the cache.db file will accumulate stale rows indefinitely, consuming disk space unnecessarily.

Suggested Fix

Add a Prune() method to cache.Store and call it during Open() or on a probabilistic basis during Set().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions