aggressively cache LazyAttachmentDoc attachments

both in local memory and in memcached
(and carefully invalidate the cache)

in the case of commcare hq's app builder (currently the only client of this code),
this saves the web worker from fetching the same attachment many times in the same request
and from fetching the same attachment between requests when it hasn't changed
:smiling_imp: