Hello Techies,


I hope you all like this blog about Platform Cache. If you don't want to use Custom Settings or sObjects, then simply go with this awesome Salesforce feature. Here, you will find all the necessary information in a single view. Also, if you don't want to use


Platform Cache stores Salesforce Session and Org data for later access and faster performance.

  • Put, retrieve, or remove cache values by using the available classes.
  • Types of Cache-

Important Considerations

  • Cache misses can happen. So always handle the Cache miss.
  • Some or all cache is invalidated when you modify an Apex class in your org.
  • Data in the cache isn’t encrypted.
  • Partitions must adhere to the limits within Salesforce.

Standard Limits (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_platform_cache_limits.htm)



  • Partitions allow you to distribute cache space.
  • To access the Partition tool in Setup, enter Platform Cache in the Quick Find box, then select Platform Cache.
  • Use the Partition tool to:
    • Request trial cache.
    • Create, edit, or delete cache partitions.
    • Allocate the session cache and org cache capacities of each partition, and many more..
  • Store and Retrieve values from Session & Org Cache-
    • To get Partition- Cache.Org and Cache.Session classes
    • Cache Key Name format- Namespace.Partition.Key
    • Add Cache Value to the Partition- Cache.Org.put(Namespace.Partition.Key, Value, Timestamp(optional))
    • Retrieve Cache value from Partition- String cachedValue = (DataType) Cache.Org.get(Namespace.Partition.Key)

I have used this very useful feature currently in my project to keep track of a particular time duration for sending an Email Notification to the user if the site is in Idle mode for a long period of time via monitoring it through the Chrome Extention.

If you have also used this feature in a real-time, please comment below share your respective use cases.


Happy to share this with you!!

This is Open Community Blogger Platform and community forum of SFDC professionals interested to share their experiences, ideas, and thoughts or any content invaluable to help others in this domain.