Usecase: I'd like to cache important/high-priority chunks of files, such as those storing metadata, without them being replaced in the cache by a read that happens to cause the size of the cache to reach its limit.
I've been trying to think about how this can be implemented.
One way is to add a flag to rclone's read operations (on cache remotes) that specifies whether this read is allowed to modify the cache at all; if the flag is set to not allow modification, the read can only read from the cache. A "serve" or "mount" would have to specify this flag globally, because its read operations are generally handled externally. The advantage of this method is that it seems to be, on the face of it, relatively simple conceptually and perhaps not difficult to implement.
Another way, which in some sense generalizes the first method above, is to specify a priority level on read operations (on cache remotes), such that the chunks read by this operation can only enter the cache if it's not full or there are lower-or-equal-priority chunks that can be removed from the cache to make way. This would require storing some priority level on the caches. Again, "serve" and "mount" would have to set priority globally. The advantage here is in the flexibility and control, but the disadvantage is that it certainly adds complexity. The current implementation of cache (to my understanding) corresponds to this scenario with one possible priority level, while the method above is sort of like having 2 possible priority levels but not exactly.
Interested to hear your thoughts, this would certainly be useful I believe!