> Hmmm... isn't that sort of backwards? It sounds like you're > considering > the problem as building a cache that can be taught how to > fetch data, > but to me it seems more natural to build components for fetching data > and teach them how to cache. > > The semantic for describing how something can be cached are > much simpler > than those describing how something can be fetched. I would think it > makes more sense to do something along the lines of the > Memoize module, > i.e. make it easy to add caching to your existing data > fetching modules > (hopefully using a standard interface like Cache::Cache).
Yeah, I buy that. Mostly I have been writing the fetching routines, and in sort of ad hoc fashion I have started to add on the caching stuff. I am just using a hash structure built on the modle File::CacheDir that I wrote. For me it is a two part problem that is pretty easily divisible. I have a function that checks the cache and if it returns false, then I fetch it according to the fallback. I would not be opposed to calling a different, more standard function to check the cache (set up in a more standard way), and then fetch accordingly. Earl