Author: julien_viet
Date: 2010-03-06 16:04:00 -0500 (Sat, 06 Mar 2010)
New Revision: 2017
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
Log:
fix a bug due to caching null return values in mop cache
Modified:
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java
===================================================================
---
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java 2010-03-06
18:34:42 UTC (rev 2016)
+++
portal/trunk/component/portal/src/main/java/org/exoplatform/portal/pom/config/cache/DataCache.java 2010-03-06
21:04:00 UTC (rev 2017)
@@ -86,7 +86,8 @@
private <K extends Serializable, V> V create(POMSession session,
CacheableDataTask<K, V> task) throws Exception
{
- // Nothing to do for now
+ K key = task.getKey();
+ session.scheduleForEviction(key);
return super.execute(session, task);
}
Modified:
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java
===================================================================
---
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java 2010-03-06
18:34:42 UTC (rev 2016)
+++
portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestCache.java 2010-03-06
21:04:00 UTC (rev 2017)
@@ -49,6 +49,21 @@
mgr =
(POMSessionManager)container.getComponentInstanceOfType(POMSessionManager.class);
}
+ public void testGetNullInvalidation() throws Exception
+ {
+ begin();
+ session = mgr.openSession();
+ assertNull(storage_.getPage("portal::test::nonexisting"));
+ Page page = new Page();
+ page.setPageId("portal::test::nonexisting");
+ storage_.create(page);
+ end(true);
+ begin();
+ session = mgr.openSession();
+ assertNotNull(storage_.getPage("portal::test::nonexisting"));
+ end();
+ }
+
public void testDirtyWrite() throws Exception
{
begin();
Show replies by date