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
add test for LazyAttachmentDoc cache invalidation
cache exceptions too in lazy attachment
Merge pull request #237 from dimagi/aggressively-cache-lazy-attachments

aggressively cache LazyAttachmentDoc attachments