r1099 - in xwiki/trunk/src/main/java/com/xpn/xwiki: render store user/impl/xwiki

Ludovic Dubost ludovic at users.forge.objectweb.org
Mon Jul 31 01:57:29 CEST 2006


Author: ludovic
Date: 2006-07-31 01:57:28 +0200 (Mon, 31 Jul 2006)
New Revision: 1099

Modified:
   xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiRenderingEngine.java
   xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiCacheStore.java
   xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
Log:
Transformed all caches to XWikiCache
Move virtual wiki cache to XWikiCache, limited by default to 1000 items
Allow caches to be completely deleted on flushAll
Allow clustered cache to only use one jgroups notification bus
Updated oscache to a lightly modified version of oscache



Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiRenderingEngine.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiRenderingEngine.java	2006-07-30 23:46:51 UTC (rev 1098)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/render/XWikiRenderingEngine.java	2006-07-30 23:57:28 UTC (rev 1099)
@@ -246,8 +246,10 @@
     public void flushCache() {
         for (int i=0;i<renderers.size();i++)
            ((XWikiRenderer)renderers.get(i)).flushCache();
-        cache.flushAll();
-        cache = null;
+        if (cache!=null) {
+            cache.flushAll();
+            cache = null;
+        }
     }
 
     public String convertMultiLine(String macroname, String params, String data, String allcontent, XWikiVirtualMacro macro, XWikiContext context) {

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiCacheStore.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiCacheStore.java	2006-07-30 23:46:51 UTC (rev 1098)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/store/XWikiCacheStore.java	2006-07-30 23:57:28 UTC (rev 1099)
@@ -47,21 +47,18 @@
     private XWikiStoreInterface store;
     private XWikiCache cache;
     private XWikiCache pageExistCache;
-    private XWikiCache prefsCache;
     private int cacheCapacity = 100;
-    private int prefsCacheCapacity = 1000;
     private int pageExistCacheCapacity = 10000;
 
     public XWikiCacheStore(XWikiStoreInterface store, XWikiContext context) throws XWikiException {
         setStore(store);
-        initCache(cacheCapacity, pageExistCacheCapacity, getPrefsCacheCapacity(), context);
+        initCache(cacheCapacity, pageExistCacheCapacity, context);
     }
 
-    public void initCache(int capacity, int pageExistCacheCapacity, int prefsCacheCapacity, XWikiContext context) throws XWikiException {
+    public void initCache(int capacity, int pageExistCacheCapacity, XWikiContext context) throws XWikiException {
         XWikiCacheService cacheService = context.getWiki().getCacheService();
         setCache(cacheService.newCache("xwiki.store.pagecache", capacity));
         setPageExistCache(cacheService.newCache("xwiki.store.pageexistcache",pageExistCacheCapacity));
-        setPrefsCache(cacheService.newCache("xwiki.store.prefscache", prefsCacheCapacity));
     }
 
     public void setCacheCapacity(int capacity) {
@@ -101,9 +98,14 @@
     }
 
     public void flushCache() {
-        getCache().flushAll();
-        getPageExistCache().flushAll();
-        getPrefsCache().flushAll();
+        if (cache!=null) {
+          cache.flushAll();
+          cache = null;
+        }
+        if (pageExistCache!=null) {
+          pageExistCache.flushAll();
+          pageExistCache = null;
+        }
     }
 
     public String getKey(XWikiDocument doc, XWikiContext context) {
@@ -327,21 +329,4 @@
     public void injectUpdatedCustomMappings(XWikiContext context) throws XWikiException {
         store.injectUpdatedCustomMappings(context);
     }
-
-    public XWikiCache getPrefsCache() {
-        return prefsCache;
-    }
-
-    public void setPrefsCache(XWikiCache prefsCache) {
-        this.prefsCache = prefsCache;
-    }
-
-    public int getPrefsCacheCapacity() {
-        return prefsCacheCapacity;
-    }
-
-    public void setPrefsCacheCapacity(int prefsCacheCapacity) {
-        this.prefsCacheCapacity = prefsCacheCapacity;
-        getPrefsCache().setCapacity(prefsCacheCapacity);
-    }
 }

Modified: xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java
===================================================================
--- xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java	2006-07-30 23:46:51 UTC (rev 1098)
+++ xwiki/trunk/src/main/java/com/xpn/xwiki/user/impl/xwiki/XWikiGroupServiceImpl.java	2006-07-30 23:57:28 UTC (rev 1099)
@@ -68,8 +68,10 @@
     }
 
     public void flushCache() {
-        groupCache.flushAll();
-        groupCache = null;
+        if (groupCache!=null) {
+            groupCache.flushAll();
+            groupCache = null;
+        }
     }
 
     public Collection listGroupsForUser(String username, XWikiContext context) throws XWikiException {





More information about the Xwiki-notifications mailing list