Brian Akins wrote: > Issac Goldstand wrote: > I can see how other tracking information (like how often the >> cached entity is accessed, last access time, etc) would be useful, >> albeit expensive to keep track of, but I don't understand this specific >> example. > > It's not expensive, as these methods are only called when an object to > added or deleted, which is relatively few if you get good cache hit ratio.
Not necessarily. The point would be to track "hot" objects so the garbage collector prioritizes them lower than a fresher entry which doesn't get accessed much. Tracking information like that would need to be done on every cache hit. stating the file is enough to get the initial creation time + last access time (which is why it makes sense, to me at least, to prefer the filesystem's atime overhead to trying to out-do that code on our own) > There are instances when you need to "purge" url's selectively. Think > a publishing system that automatically purges cache for updated pages, > for example. > Right. But you can still do it with an open_entity() (which takes the cache key and sets the filehandles and everything else in the cache_handle) and then remove_entity. My gut instinct tells me that rewriting remove_entity to take the key instead of the cache_handle will have side-effects of tracking whether the filehandles in the cache_object are open or closed...