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:


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

example-autoexpirylocalcache.xml (text/xml) (text/plain)