On 3/16/07, Gottlob Frege
I had an idea for a general cache, based on the idea that caches are essentially trying to avoid re-calling expensive functions with the same parameters as last time. So typically you build a cache key from the params, put it in a map, etc. But what if we did things slightly differently...
<snip>
Basically, instead of building a key from the params, build a key from the params + the function that takes the params. Then, as a bonus, you don't need to worry about packing/unpacking the params - just let bind() do that for you! The other bonus is that you can cache things that may be created via different methonds.
So what's the problem?
Other than what you specify, it sounds like the memory overhead on that will be very high, something you don't exactly want in a cache. I think a generic cache that could use anything from functions to strings to integers as keys would be preferable.
- Tony
-- Cory Nelson http://www.int64.org