Point taken, but it would only be for a short period of time while the method is being invoked. Our application is willing to accept that the entries might have been subsequently evicted after being copied out of the cache. If they are subsequently expired, the next invocation would only have to get those that were just expired. Our current implementation is very spring specific with the cache wrappers we use, but the idea is certainly generalizable.
Basically, right now, we implement our own org.springframework.cache.CacheManger instead of using the default one spring provides and getCache method can return a wrapper around the spring cache and we can do all kinds of fancy stuff by implementing the get, put, and evict with additional logic. However, it doesn't support the use case I described without modifying the List passed in and running into potential ConcurrentModificationExceptions.
Does the reference implementation already have annotation support?
Thanks. I appreciate the discussion.
Max