implements caching of metadata.  pray that this doesn't thrash memcached.
don't bother with the cache if cache duration is 0