I've been thinking about adding some API's for cache control in EL. My
original idea was to add two methods
Mark m = mark(); // place a marker
release(m); // release cache in this thread since m was marked.
There probably should be a restriction that marks and releases be
properly nested, so that caches can be allocated and released like a stack.
The above scheme would probably work well for a single threaded
execution, but not in a mutli-threaded program. Since marks and
releases from other threads can come randomly, I don't know how to
implement these methods properly and efficiently, and I suspect that
such API is not useful at all.
One can argue that with this API, caching should be implemented on a per
thread basis, with no sharing between threads. I suspect there may be
very little common expressions between threads anyway. However, this
would rely too much on user interactions, and can lead to memory
leakage if an user forgets to call release at the right time.
In any case, cache control is an optional part of the spec, since it
cannot be probably tested. If any of you have other ideas, please
share, otherwise I'll move it down the priority list for now, and come
back to it later if we have time.
Kin-man