Closed martinlovell closed 4 years ago
FWIW (and if I recall correctly), the cache used to be a pairtree-like structure, but that was changed for some reason. Might be worth poking through old issues/commits to see why.
We are running into this issue, and it seems like this suggested change would be helpful. @alexwlchan do you have any thoughts?
Looks like issue #143 and PR #146 are related. @jpstroop, @alexwlchan seems like we could do something like _ident_file_structure, but still use identifier name. Something like this: cache/ab/cd/ident/...
How does that sound?
PR #479 would implement this change for the InfoCache (using the same directory format that the SimpleHTTPResolver uses).
I would like to do the same thing for the derivative ImageCache. Anyone opposed? Anyone need the derivatives cache to stay the way it currently is?
PR #479 Was merged. Does that close this issue?
Yes, with #483. Closing.
Currently the image and info cache create a directory per ID in the root of the cache (after the protocol) in ImageRequest.cache_path and InfoCache._get_info_fp/_get_color_profile_fp. This could cause performance problems with some file systems because of many entries in one directory.
The implementation could optionally split the entries into more directories by doing something like SimpleHTTPResolver._ident_file_structure for those who server up many different IDs. It could be an option so those who don't need it, don't have to use the resources to build the file structure for each request.