Platform cache allows you to cache data in Salesforce server. Accessing platform cache is faster than getting data by querying from objects or custom settings.
Use cases
- Storing API session token till it expires
- Caching frequently called API response data
- Caching results from time consuming operations like complex queries and calculations
Types of platform cache
-
Session Cache
Stores data in association with user’s session. Maximum life is 8 hours. Only the user who put data to this cache can retrieve it back.
-
Org Cache
Data is stored at the org level. Any user can access data in cache.
How to setup
- Go to Setup -> Platform Cache
- Click on “New Platform Cache Partition” button
- Enter necessary details and click “Save”. You can select “Default” checkbox to make the partition your default partition to avoid specifying partition name which caching data
It is recommended to create a separate class to manage all operations with cache. You can see an example of using a service class to manage org cache below. CacheService class is used to just manage cached data and ExternalSystemAPI class leverages that class to cache access token.
http://promotion.vforums.co.uk/board/general/topic/17329/action/view_topic/alibaba-cloud-acp-cloud1-exam-questions
ReplyDeleteNice and good article. It is very useful for me to learn and understand easily. Thanks for sharing
ReplyDeleteServiceNow Admin Online Training
ServiceNow Online Training in India