Skip to content

Cache room and message data on disk for faster startup #83

@sgrimee

Description

@sgrimee

Summary

Implement persistent disk caching for room and message data to significantly reduce startup time by avoiding the need to re-fetch all data from the server on each launch.

Requirements

  • Cache room metadata and message history to disk
  • Load cached data on startup for immediate UI population
  • Update cache when loading fresh data from server
  • Maintain message ordering and structure integrity
  • Handle cache invalidation when server data changes

Research Needed

  • Investigate Rust best practices for data serialization/storage (serde, bincode, JSON, etc.)
  • Evaluate performance trade-offs of different storage formats
  • Consider cache size management and cleanup strategies

Implementation Considerations

  • Cache may contain more message history than typical API calls (due to pagination)
  • Must preserve message ordering and threading structure
  • Leverage existing functions that ensure messages are inserted correctly
  • Integrate with existing cache system in src/app/cache/
  • Handle concurrent access to cache files
  • Consider cache versioning for schema changes

Critical Requirements

  • Message structure correctness must be maintained
  • Cache updates should be atomic to prevent corruption
  • Graceful fallback when cache is corrupted or missing
  • Efficient merge of cached and fresh data from server

Acceptance Criteria

  • Room and message data persists between sessions
  • Startup time significantly reduced with cached data
  • Cache updates correctly when new data arrives from server
  • Message ordering and structure integrity maintained
  • Cache handles pagination and history correctly
  • Performance acceptable for large message histories

🤖 Generated with Claude Code

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