Doing this all in memory seems too complex. Probably I'm missing something, but why not do it with files? Create a file to store the cached data. Then, when the data is needed again test to see if it's still there or has been discarded by the kernel. The data would never touch any backing store, living in RAM until discarded.
The concept could even be extended to disks, with files that are automatically removed by the kernel if the free space on the file system goes below certain threshold.
It seems so obvious that I have the feeling that this already does exist, doesn't it?