On 08/25/2011 06:00 AM, Caleb James DeLisle wrote:
In order to fix a problem with the cache, I would like
to add a pointer type to the storage api.
The problem with the cache is there are multiple names which, when asked of the
persistent store,
return the same document. There is no effective way to know what all names which will
return that
document. When a document is modified, it is removed from the cache but the only version
removed is it's
"real" name. All of the other names for it linger in the cache eating up memory
and threatening to
provide someone stale data.
Instead of caching the document, we could cache a pointer to the document and when it
became stale,
the pointer could be set to null and then any other name under which that document was
cached would look
up a null pointer and the cache logic could remove it.
I would like to add it to xwiki-platform-store-api module and it will look roughly like
this:
package org.xwiki.store;
public final class Pointer<T>
{
/** The thing which this pointer points to. */
public T target;
}
In the issue you mention two fields, did you find a way to do it with
only one?
Personally, I would prefer to fix the way we request things from the
cache, so that there aren't different requests for the same thing, but I
know that is hard to fix and much harder to impose on API users.
+1.
WDYT?
--
Sergiu Dumitriu
http://purl.org/net/sergiu/