[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] How to clear Cache
|
Alright, my solution is:
- I am using a SessionCustomizer
- adding a SessionEventAdapter
- override preExecuteQuery
- call Session.getIdentityMapAccessor().initializeAllIdentityMaps()
Codesnippet:
public void customize(Session session) throws Exception {
SessionEventAdapter evtListener = new SessionEventAdapter() {
@Override
public void preExecuteQuery(SessionEvent event) {
Session aSession = event.getSession();
// check if cache invalidation is necessary....
// if yes:
aSession.getIdentityMapAccessor().initializeAllIdentityMaps();
}
}
}
Open Questions:
- is preExecuteQuery the right place?
- Does any better solution exist?
Thanks
Mc.Joe
Joe Mc. wrote:
>
> Hi everybody,
>
> I trying to provide a functionality to delete the whole cache, to support
> the possibility to refresh the objects in the cache.
> How is the best practice to flush the whole cache?
>
> I have the following use case:
> - 2 separate Applications on different servers
> - Both use JPA Eclipselink
> - Application A reads the objects, I am using SoftWeak
> - Application B modifies sometimes the data
>
> desired is, that Application B gives Application A a signal (details are
> here irrelevant), if he modified the data
> Application A will flush his cache, if he gets this event.
>
> Now the question is: Does any API exists to flush the (whole) cache?
>
> Thanks in advance
>
> Mc.Joe
>
--
View this message in context: http://www.nabble.com/How-to-clear-Cache-tp23567622p23573096.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.