public void persistCache(Cacheable cacheable)
{
String cacheKey = cacheable.getCacheKey();
- LinkedHashSet<String> foundCache = getAllCachedItemsFor(cacheable);
- String commaJoinedStr = String.join(CACHE_DELIMITER, foundCache);
- Cache.setProperty(cacheKey, commaJoinedStr);
+ LinkedHashSet<String> foundCacheItems = getAllCachedItemsFor(cacheable);
+ StringBuffer delimitedCacheBuf = new StringBuffer();
+ for (String cacheItem : foundCacheItems)
+ {
+ delimitedCacheBuf.append(CACHE_DELIMITER).append(cacheItem);
+ }
+ if (delimitedCacheBuf.length() > 0)
+ {
+ delimitedCacheBuf.deleteCharAt(0);
+ }
+ String delimitedCacheString = delimitedCacheBuf.toString();
+
+ Cache.setProperty(cacheKey, delimitedCacheString);
}
}