Persistences (Abstract) - General considerations

If you want your values (V) to be persisted (or they are already persisted), you will to use/extend a
witch extends from AbstractPersistenceValueManager.

This should be USED when it is more expensive to retrive the Value(V) from its origin than to load it from a file persisted version.
Such a manager has several purposes.
Store How to persist the value.

Retrieve How to retrive the value.

Setting How to set the expire datetime on the persisted object.

Deleting How to delete the value when the key is remove or expired..

Restoring How to restore key, expiration datetime and value from the persisted storage, when the application have had downtime.

When are cache is restored, there are fours ways which has to be implemented, determined in the PersistencesRestoreMethod.

NOTHING No action is perform on the persistence storage and the map remains empty after restoring and any persisted values remains untouched.
And any previous persisted object will remain in the "storage" untouched are someone else has to "deal" with those objects.

DELETE_ALL Do not used any of the "old" caching value objects, be ensure that the "old" storage is cleaned up and the map remains empty after restore.

LOAD_ALL Load all values from the "old" storage and restoring the map with them, any cleanup will be performed by the "cleanup" method.
Setting a new expiration time using the default value.

LOAD_WITHIN_EXPIRETIME Load only the values from "old" storage which you can determine that is below expireDateTime, reminder persisted values is removed.
Using expiration time if can be determined from "object" otherwise use default value.

One VERY IMPORTANT configuration is the LRUCachingMapConfiguration.html.setPersistedValuesInMemory(boolean).

This determines if values for shall be held on memory for persisted storages, or be loaded from persisted storage each time.

There can be several reasons you want to use a persisted value storage:
  • Want to minimize memory foot print of your cache.

  • Want to have your cache to be robust from downtime and have your cache preserved.

But there are some downsides to persistend value storage:
  • IO time is expensive.