|
From: Richard H. <rj...@za...> - 2023-12-25 14:18:35
|
On 23/12/2023 21:35, TheFGFSEagle wrote: > > However do remember that once created the cached image will not be > recreated. > > … then we definitely should add an Nasal API to force that, I think ! Not easy because the cache uses the hash of the contents as the filename so there isn't a way to clear selectively unless we maintain a database mapping between the filenames and the hashes. It does create a log file 'cache-index.txt' but this is only appended to - so anything that maintains the cache would also have to maintain this. All of these design choices were made because the cache is created during the paged loader - which can be called from multiple threads; so doing it differently would not be easy. The last thing to remember is that because it uses a hash of the file contents to identify the texture it is possible that many texture files that have identical content will end up with the same texture in the cache. Of course it's possible to do all of this - however there will have to be careful thought on how to handle the data in a thread safe way (without locking because that partially defeats the point of background loading). |