Update removeCache() to delete corresponding cache file saved to disk; also updated getCacheData() to remember cache loaded from disk. C3_BUILDER_WORK
authorstechong
Tue, 27 Jul 2010 11:13:38 -0500
branchC3_BUILDER_WORK
changeset 1692 3980cf3d4074
parent 1691 b249ba29f642
child 1693 de004e8bf5cb
Update removeCache() to delete corresponding cache file saved to disk; also updated getCacheData() to remember cache loaded from disk.
core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java
--- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java	Tue Jul 27 10:31:29 2010 -0500
+++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java	Tue Jul 27 11:13:38 2010 -0500
@@ -103,7 +103,11 @@
 	}
 
 	public void removeCache(String identifier) {
-		caches.remove(identifier);
+		CacheEntry cache = caches.get(identifier);
+		if (cache != null) {
+			caches.remove(cache);
+			cache.delete();
+		}
 	}
 
 	public <T> T getCachedData(String cacheIdentifier, Class<T> expectedClass, long freshness) {
@@ -118,6 +122,7 @@
 			T result = cache.getData(expectedClass);
 			if (cachedFreshness == freshness && result != null)
 			{
+				caches.put(cacheIdentifier, cache);
 				return result;
 			}
 			else