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;
}
WDYT?
Caleb