Firefox Cache in RAM
- posted:
2025-05-13
HTTP is designed to cache objects - such as html pages, jpeg images, css stylesheets, and etc. - as much as possible [1], because that way it not only reduces the load on the server, but also saves bandwidth for users of the HTTP service. However, it is estimated that only a fraction of cached objects will be reused, usually about 30%, because of very short object expiration time, updates or simply user behavior (loading new pages instead of returning to the ones already visited) [2].
In Firefox (the web browser of my choice), cached objects can be stored either in memory or on disk. Disk caching offers greater capacity but results in frequent disk writes, which could reduce the lifespan of disks - especially SSDs (solid-state drives). Memory caching, on the other hand, stores fewer objects but provides faster access and enables unlimited read/write cycles. It's hard to say which one is better - it really depends on your use case and specific situation. Personally, I want to extend my SSD's lifespan, so I switched to memory caching.
By default, Firefox uses disk caching. To configure it to cache in memory instead, open the page about:config in Firefox:
Set browser.cache.disk.enable to false for disabling disk caching.
Set browser.cache.memory.enable to true for enabling memory caching.
Set browser.cache.memory.capacity to the desired amount of KB for the maximum memory to be used for memory caching - by default, it is set to -1 for automatic cache size selection [3], which is 32768 KB for my laptop.
After that, open the page about:cache to check if the new settings have taken effect - it should look something like this:
However, there are two exceptions that will never store in memory:
cookies: Wesite cookies remain stored on disk as usual, which allows login sessions to persist even after restarting Firefox.
videos: Playing videos on Firefox uses disk to store cached videos.
Thanks for reading :)