notion-cms
notion-cms copied to clipboard
Use an in memory cache to avoid frequent JSON ops and disk writes.
Description
Proposing an enhancement to optimize our API data caching strategy, addressing performance issues related to file I/O and JSON processing.
Proposed Enhancement
- Implement HTTP caching using headers like
ETag
andLast-Modified
. - Create a separate caching module to manage in-memory and disk-based caching efficiently.
- Enforce singleton pattern for the caching module to maintain state across the application.
- Optimize file operations and JSON handling for better performance.
- Document the caching strategy and ensure consistency across the team.
Goals
- Improve performance by reducing unnecessary network traffic and data processing.
- Enhance maintainability and scalability of the caching mechanism.
Next Steps
- [ ] Select Node.js libraries for HTTP and in-memory caching.
- [ ] Develop and integrate the separate caching module.
- [ ] Update documentation with guidelines on caching module usage.
- [ ] Implement tests and tooling to ensure adherence to new caching strategy.
- [ ] Monitor performance impact after implementation.
It's possible this will be v1 compatible since we keep the disk cache, just use it less frequently.