1
votes

Does anyone know the exact time eclipselink need to flush its shared cache ? I have made changes directly to the database. As the application written in java uses eclipselink for persistence the changes made directly to the database are reflected only after a certain duration of time. This is because of eclipselink's shared cache as it caches the value.

1

1 Answers

2
votes

It depends on your configuration. From the EclipseLink user guide:

By default, entities remain in the shared cache until they are explicitly deleted or garbage collected.

This also further depends on your Cache Type & Size configuration.

The first link states how to set an expiration time on particular entities by using the expiry or expiryTimeOfDay attributes of the @Cache annotation, e.g. @Cache(expiry = 600000). I don't think there is a global setting that can be applied to all entities, but this might help: Configuring Cache Expiration at the Project Level

Alternatively, if you're expecting data to be stale, you can explicitly refresh the cache.