How do I control the expiry of a cached object by type?

The attached example demonstrates the "different object type, different expiry length" implementation.

The example configuration shows String objects being cached for 3 minutes and Integer objects being cached for 10.

To use a default expiry, make java.lang.Object the last item in the configuration and give it the default number of seconds to expire. For example, for one whole day use:

<init-param>
   <param-name>java.lang.Object</param-name>
   <param-value>86400</param-value>
</init-param>

To plug it in, just configure the caches to use the attached backing map instead of "default-backing-map" using the attached xml snippet.


Attachments:
example-autoexpirylocalcache.xml (text/xml)
AutoExpiryLocalCache.java (text/plain)