Skip to content
Snippets Groups Projects
Commit 750885bc authored by Thomas Mortagne's avatar Thomas Mortagne
Browse files

[misc] Remove useless stuff

parent 8d9acba4
No related branches found
No related tags found
No related merge requests found
......@@ -64,10 +64,6 @@ public class XWikiCacheStore implements XWikiCacheStoreInterface, EventListener
private Cache<Boolean> pageExistCache;
private int cacheCapacity = 500;
private int pageExistCacheCapacity = 10000;
/**
* Used to know if a received event is a local or remote one.
*/
......@@ -105,34 +101,12 @@ public List<Event> getEvents()
new WikiDeletedEvent());
}
// FIXME: init cache only at init and when asked for it instead of lazily in each method
public void maybeInitCache(XWikiContext context) throws XWikiException
public void initCache(XWikiContext context) throws XWikiException
{
if ((this.cache == null) || (this.pageExistCache == null)) {
initCache(context);
}
}
int cacheCapacity = (int) context.getWiki().ParamAsLong("xwiki.store.cache.capacity", 500);
int pageExistCacheCapacity = (int) context.getWiki().ParamAsLong("xwiki.store.cache.pageexistcapacity", 10000);
public synchronized void initCache(XWikiContext context) throws XWikiException
{
if ((this.cache == null) || (this.pageExistCache == null)) {
try {
String capacity = context.getWiki().Param("xwiki.store.cache.capacity");
if (capacity != null) {
this.cacheCapacity = Integer.parseInt(capacity);
}
} catch (Exception e) {
}
try {
String capacity = context.getWiki().Param("xwiki.store.cache.pageexistcapacity");
if (capacity != null) {
this.pageExistCacheCapacity = Integer.parseInt(capacity);
}
} catch (Exception e) {
}
initCache(this.cacheCapacity, this.pageExistCacheCapacity, context);
}
initCache(cacheCapacity, pageExistCacheCapacity, context);
}
@Override
......@@ -179,9 +153,6 @@ public void saveXWikiDoc(XWikiDocument doc, XWikiContext context, boolean bTrans
doc.setStore(this.store);
// Make sure cache is initialized
maybeInitCache(context);
// We need to flush so that caches
// on the cluster are informed about the change
String key = getKey(doc, context);
......@@ -284,11 +255,6 @@ public XWikiDocument loadXWikiDoc(XWikiDocument doc, XWikiContext context) throw
// Calculate the cache key
String key = getKey(doc, context);
LOGGER.debug("Cache: begin for doc {} in cache", key);
// Make sure cache is initialized
maybeInitCache(context);
LOGGER.debug("Cache: Trying to get doc {} from cache", key);
XWikiDocument cachedoc;
......@@ -351,9 +317,6 @@ public void deleteXWikiDoc(XWikiDocument doc, XWikiContext context) throws XWiki
this.store.deleteXWikiDoc(doc, context);
// Make sure cache is initialized
maybeInitCache(context);
getCache().remove(key);
getPageExistCache().remove(key);
getPageExistCache().set(key, Boolean.FALSE);
......@@ -663,9 +626,6 @@ public boolean exists(XWikiDocument doc, XWikiContext context) throws XWikiExcep
// Calculate the cache key
String key = getKey(doc, context);
// Make sure cache is initialized
maybeInitCache(context);
try {
Boolean result = getPageExistCache().get(key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment