OSCache - OSCache 2.0 beta 1

### Release Notes (19th July 2003 - by Chris Miller) #### New Features: CACHE-11 Cache grouping support. This allows cache entries to be placed into an arbitrary group or groups and flushed with a single flushGroup() call. CACHE-30 Added support for expiring cache entries based on a cron expression. Entries that are older than the date/time that most recently matches the cron expression will be considered stale. This is exposed to the cache tag via the 'cron' attribute. See cronTest.jsp for examples. Event listener support has been refactored and improved. It is now possible to specify a comma-delimited list of event listeners using this property. Previously only one class could be specified. Events listed here should implement the CacheEntryEventListener and/or the ScopeEventListener interfaces. New event CacheMapAccessEvent.STALE_HIT. This event is fired when an attempt is made to retrieve and entry from the cache, and the entry is found but is stale. Clustering support has been added as an event listener. Currently it is implemented using JavaGroups . To enable, just add the BroadcastingCacheEventListener class to the cache.event.listeners property. Now uses Jakarta Commons Logging for all log messages. This means that the cache.debug configuration property is now ignored - use whatever logging configuration is appropriate for your logging setup instead. -Fabian Crabus CACHE-14, Matthias Nott Now allows for content to be cached indefinitely without expiration. The build.xml <javac ...> directives now specify debug="true". Performance boost: When OSCache is running on JRE 1.4 or higher, LRUCache and FIFOCache use a LinkedHashSet instead of a LinkedList. Japloy is now used to ensure source is consistently formatted. Test cases now work on non-windows platforms. Also coverage reports added courtesy of clover. #### Changes that may affect backwards compatibility: The cache.entryevent.classes property in the configuration file has been renamed to cache.event.listeners, since it accepts CacheEntryEventListener, ScopeEventListener and CacheMapAccessEventListener types. The cache.persistence.classes property has been renamed to cache.persistence.class since it is only possible to specify one PersistenceListener. For consistency, cache.unlimited_disk is now cache.unlimited.disk and cache.useHostDomainInKey is now cache.use.host.domain.in.key. The oscache.tld file now uses a taglib 1.2 DTD. To build OSCache, JDK 1.4.x or higher is required. There is however no runtime dependency on JDK 1.4.x. The Cache.flushPattern() method and <cache:flush pattern="..."/> are deprecated. You are instead encouraged to group your cache entries when you add them to the cache and then use the Cache.flushGroup() method or the <cache:flush group="..."/> tag to flush an entire cache group. Disk persistence now puts all files in the same directory. This has a number of side effects. Keys >255 chars will cause problems. Also, similar keys might get mapped to the same file. For example, it is very inadvisable to have two keys with the names 'my_key' and 'my.key'. GeneralCacheAdministrator is no longer static. Users that relied on this behaviour can still hold onto a static reference to it with minor code changes. When a NeedsRefreshException is thrown, it is now vital that the cache entry is either updated, or Cache.cancelUpdate(key) is called to release the lock on this cache entry. This is a consequence of the fix for CACHE-42 . CacheProperties class was removed. It didn't work on 1.7.5 anyway. The same effect can be achieved by specifying a subclass of Properties. Autogenerated cache keys now contain the request method (eg, HEAD, GET, etc). OSCache has been repackaged from "com.opensymphony.module.oscache.*" to "com.opensymphony.oscache.*". Any code or configuration files that refer to "com.opensymphony.module.oscache" will need to be updated. #### Bug Fixes: CACHE-4 WebSphere 3.5.x compatibility. CACHE-5 Added a mode attribute to the cache tag to allow content to be cached but not sent to the output stream. See oscacheTest.jsp for an example. CACHE-7 "cache" Tag has no "setEncoding" method. CACHE-9 It could be useful being able to specify directories relative to the web application dir. for config file and cache dir. Use new properties aware getInstance method. CACHE-10 Cannot write and use custom class implementing CacheProperties. CACHE-13 AbstractConcurrentReadCache loops indefinitely when persistRetrieve() returns null. CACHE-14 You can now specify an unlimited refresh time by supplying a negative value for the duration. CACHE-17 An example war is now included - "ant example-war". Once deployed this can be tested using "ant test-web". CACHE-26 Security hole whereby certain keys can overwrite any file. CACHE-28 URLs can now be used as keys with disk persistence. CACHE-31 and CACHE-33 The cache tag's refresh attribute will now be taken into account even if a custom refresh policy has been specified. CACHE-34 Setting properties with AbstractCacheAdministrators. New getInstance method added to ServletCacheAdministrator that takes in properties. CACHE-35 CacheFilter needs to distinguish between HEAD and GET requests. CACHE-39 and CACHE-44 Synchronization with LRUCache fixed. CACHE-42 Threads will no longer race to (re)build expired or new cache entries. By default stale content will be served if available. This behaviour can be changed by setting oscache.blocking=true, which will instead cause threads to block until the new cache entry is available. CACHE-43 Taglibs have been made spec-compliant. They now follow the guidelines at http://jakarta.apache.org/taglibs/guidelines.html. Some synchronization issues were fixed in LRUCache.getItem() and AbstractConcurrentReadCache.setMaxEntries(). ScopeEventListener classes were previously not able to be specified in the configuration even though the dispatching code was implemented. ScopeEventListeners can now be specified using the cache.event.listeners configuration property. CacheMapAccessEvents now only fire when an attempt is made to retrieve the actual cache content for external use. Previously these events were being fired in circumstances that were not of statistical interest - for example HIT and MISS events were being fired when updating or flushing entries from the cache. Minor bug in oscacheTestMultipleTagNoKey.jsp - some of the tag refresh times weren't correctly specified. cachetest.jsp - the 'refresh' functionality wasn't working because the addition of the refresh parameter caused the cache key to be different. The key is now specified explicitly. EntryRefreshPolicy is now serializable so it can be persisted to the disk cache. ServletCacheAdministrator now sorts request parameters and filters out jsessionid so they have no impact on the generated cache key. CacheFilter only caches successful responses (status code == SC_OK). #### Known Problems: (these have existed for some time in the 1.x.x versions and will be addressed in an upcoming 2.x.x release) Session caches (created using the ServletCacheAdministrator) have some known limitations: o Due to a workaround in the code, it is possible for a system under heavy load to get its persistent session caches confused across sessions. o Session caches will not work in a clustered environment. o Session caches have the same settings global settings applied to them as the application scope cache. This means that if you want a persistent cache for the application scope cache, the session caches will use it too.