There are a few considerations for using platform cache features.
- Cache is not persisted. There is no guarantee against data loss.
- Data in the cache is not encrypted.
- The cache doesn’t support concurrent operations. Multiple, simultaneous user requests
(for example, from different browser windows) can lead to stale or overwrritten data in
the cache.
- Cache misses can happen. We recommend constructing your code to consider a case where
previously cached items aren’t found.
- The session cache isn’t supported in Anonymous Apex blocks. For
example, if you execute Anonymous Apex in the Developer Console, you’ll get an
error.
- Cache operations made using the Cache Namespace aren’t supported in constructors of Visualforce controllers.
- Partitions are bound by the limits within Salesforce.
- The session cache and org cache can store values for a maximum of eight hours.