Skip to content

Make LRU cache size configurable for static file handler #131

Open

Description

@coderabbitai

Description

The static file handler introduced in PR #127 uses a hardcoded LRU cache size of 10,000 entries for caching file metadata (_FileInfo objects containing MimeType, FileStat, and ETag).

Current Implementation

The cache is currently hardcoded:

static final _fileInfoCache = LruCache<String, _FileInfo>(10000);

Requested Enhancement

Make the cache size configurable through the createStaticHandler function parameters, allowing users to:

  • Adjust cache size based on their specific use case and memory constraints
  • Disable caching entirely if needed (cache size = 0)
  • Set appropriate cache sizes for different deployment scenarios

Context

Acceptance Criteria

  • Add optional cacheSize parameter to createStaticHandler
  • Support cache size of 0 to disable caching
  • Maintain backward compatibility with reasonable default cache size
  • Update documentation with cache configuration guidance

Activity

  1. moved this from Inbox 📫 to Backlog 🗂️ in Serverpod Frameworkson Aug 28, 2025
  2. added
    enhancement
    area: configuration
    and removed
    enhancement
    on Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: configuration

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions