Newer Version Available
Platform Cache Considerations
Review these considerations when working with Platform Cache.
- Cache isn’t persisted. There’s no guarantee against data loss.
- Data in the cache isn’t encrypted.
- The cache doesn’t support concurrent operations. Multiple, simultaneous user requests (for example, from different browser windows) can lead to stale or overwritten data in the cache.
- Cache misses can happen. We recommend constructing your code to consider a case where previously cached items aren’t found.
- Session cache doesn’t support asynchronous Apex. For example, you can’t use future methods or batch Apex with session cache.
- Session cache doesn’t support Anonymous Apex blocks. For example, if you execute Anonymous Apex in the Developer Console, you get an error.
- Cache operations made using the put and remove methods in the Cache Namespace aren’t supported in constructors of Visualforce controllers.
- Partitions must adhere to the limits within Salesforce.
- The session cache can store values up to eight hours. The org cache can store values up to 48 hours.