On 09/07/2010 06:52 AM, Caleb James DeLisle wrote:
Hi,
There are 2 reasons I want to stop caching documents when they are stored.
1. Coherence, it should be impossible for the cache to have a different entry than the
store.
Suppose a document is stored and the storage fails without throwing any error, the
document will appear to be
stored correctly until the cache is purged. Another more likely scenario is that the
document loaded from the
store is slightly different than the document saved to the store and thus the cache will
be lying.
2. Performance, when an attachment is added to a document, the document contains all of
the attachment's
content. My analysis tells me switching to holding the content with a soft reference
would be quite complex
and proving that nothing depends on the attachment content not being null is very
difficult.
The proposed change will prevent the attachment content from ever being stored in the
cache and provide an
improvement in allowable cache capacity and memory footprint.
That's an incredibly small but very efficient idea, +1.
Most good ideas seem obvious in retrospect...
Don't forget to remove the document from the cache, if it was already there.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/