Rupinder,
From use case perspective: we are using Cache for cross references (e.g. Converting EA to Each, USA to US and so on).
While 95% of these are static, our users can perform CRUD operation on cache entries. In such scenario - users can trigger a "clear cache". Subsequent transactions' call to cache leads to cache loader getting called till entire cache is hydrated again.
We also have Xalan "extensions" built to be invoked in XSLT services that leverage these cache extensively.
The reason to use java cache loader is because - that is actually only mechanism available from ehcache/webMethods as part of this process (IBM/webMethods could provide a sample cache loader or a generic cache loader sample - but it doesn't exist currently).
We can query DB Directly from Cache Loader (using JDBC Operation) - and that is one of the options we had used (Traditionally, this was based on JPA etc.). We are in process of making these frameworks lighter to keep containers smaller as well as reduce dependencies on non-webMethods code much as possible.
One of the process I have tried is invoking following directly:
Service.doInvoke(ifc,serviceName, inputPipe);
Cache loader gets called, logs get printed - but actual service doesn't get called - also no exception is thrown.
Interestingly enough: if my service name is "incorrect", it does error out ([ISS.0026.9201] Unknown service).
We have been using Context pattern for a while (10y+), but that is requiring us to store username and password and access it within loader (Alternative would be to use X509). Mainly we are trying to identify a way to avoid storing and accessing credentials.