Skip to content

fix: add database size limits and cache eviction to prevent unbounded…#33

Closed
linhdmn wants to merge 1 commit intomainfrom
fix/db-size-eviction
Closed

fix: add database size limits and cache eviction to prevent unbounded…#33
linhdmn wants to merge 1 commit intomainfrom
fix/db-size-eviction

Conversation

@linhdmn
Copy link
Copy Markdown
Member

@linhdmn linhdmn commented Apr 28, 2026

… growth

  • Add MAX_CACHE_ENTRIES (10,000) limit for persistent cache with 90% threshold eviction
  • Add entry_count tracking to monitor cache size
  • Implement evict_if_needed() and evict_oldest_expired() for automatic cleanup
  • Add database size monitoring in watcher with MAX_DB_SIZE_BYTES (500MB) limit
  • Check db size every DB_SIZE_CHECK_INTERVAL (100) file changes
  • Add monitoring methods: size(), prune(), database_size_approx()

Summary

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Chore

Testing

  • Unit tests pass (cargo test)
  • Integration tests pass
  • Manual verification

Checklist

  • Code follows project conventions
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings or errors

Breaking Changes

Related Issues

Additional Context

… growth

- Add MAX_CACHE_ENTRIES (10,000) limit for persistent cache with 90% threshold eviction
- Add entry_count tracking to monitor cache size
- Implement evict_if_needed() and evict_oldest_expired() for automatic cleanup
- Add database size monitoring in watcher with MAX_DB_SIZE_BYTES (500MB) limit
- Check db size every DB_SIZE_CHECK_INTERVAL (100) file changes
- Add monitoring methods: size(), prune(), database_size_approx()
@linhdmn
Copy link
Copy Markdown
Member Author

linhdmn commented Apr 29, 2026

Merged - commits are in main

@linhdmn linhdmn closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant