Chrome loading stylesheet from disk cache, never memory cache

Viewed 696

I'm trying to figure out why a stylesheet from a website I'm developing always loads via Chrome's disk cache instead of Chrome's memory cache. Expires dates are set for the file. All other resources are loaded from the memory cache.

Network screenshot from Chrome

1 Answers
  1. Load files manually into a ramdisk:
  • Windows: ImDisk Toolkit (Tip: check the "dynamic allocation" to save on ram space, prefer to use ExFat instead of NTFS if you'd like to save on a few megabytes upon creation)
  1. I use the node package npm install http-server -g to host it locally, since chrome does not allow to load it from file:/// for security reasons.
  2. Load it as usual: <link rel="stylesheet" href="http://127.0.0.1:8080/tailwind.min.css">

Be aware that http-server default settings will host the files to the local network alongside just http://127.0.0.1:8080.

It might be redundant after the first load, but worth trying

  • http-server also seems to cache regular disk accesses, as by their doc.
  • On my chrome 96.0.4664.110 (Official Build) (64-bit) after I refresh the page it appears (Memory Cache) for the CSS files I've tried, at the network tab in the element inspector, after I reload the page maybe once, I can't remember.
Related