Hi,

I am investigating a reasonable way to cache objects which have the same
livecycle as a resource resolver, because they are retrieved or derived
from it.
For example this could be the result of query, which is used at multiple
locations within my application, all in the context of the same request /
resource resolver. Right now my only way is to store them in request
attributes, but that does not feel right, because it rather relates to the
resource resolver (and not the request itself), and it requires me to pass
always the request along although I just need the resource resolver. Also
in some situations there is alrady existing code, which just passes along
the resource resolver and no request (maybe the operation does not even
work in the context of a request).

I checked the API of the ResourceResolver, and it comes with
getAttributeNames() and getAttribute(), but these properties are populated
during creation and cannot be modified afterwards. So not helpful here.

I envision to have a WeakHashMap<String,Object>, which can be reached via a
new API call "getTemporaryStorage()" (I am very open for a better name),
which we could implement as default method right in the interface.

WDYT?



-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh

Reply via email to