Newer Version Available
Platform Cache Features
-
Session cache—Stores data for individual user sessions. For example, in an app
that finds customers within specified territories, the calculations that run while users
browse different locations on a map are reused.
Session cache lives alongside a user session. The maximum life of a session is eight hours. Session cache expires when its specified time-to-live (ttlsecs value) is reached or when the session expires after eight hours, whichever comes first.
-
Org cache—Stores data that any user in an org reuses. For example, the contents
of navigation bars that dynamically display menu items based on user profile are
reused.
Unlike session cache, org cache is accessible across sessions, requests, and org users and profiles. Org cache expires when its specified time-to-live (ttlsecs value) is reached.
Additionally, Salesforce provides 3 MB of free Platform Cache capacity for AppExchange-certified and security-reviewed managed packages through a capacity type called Provider Free capacity. You can allocate capacities to session cache and org cache from the Provider Free capacity.
- Reused throughout a session
- Static (not rapidly changing)
- Otherwise expensive to retrieve
For both session and org caches, you can construct calls so that cached data in one namespace isn’t overwritten by similar data in another. Optionally use the Cache.Visibility enumeration to specify whether Apex code can access cached data in a namespace outside of the invoking namespace.
Each cache operation depends on the Apex transaction within which it runs. If the entire transaction fails, all cache operations in that transaction are rolled back.
Try Platform Cache
To test performance improvements by using Platform Cache in your own org, you can request trial cache for your production org. Enterprise, Unlimited, and Performance editions come with some cache, but adding more cache often provides greater performance. When your trial request is approved, you can allocate capacity to partitions and experiment with using the cache for different scenarios. Testing the cache on a trial basis lets you make an informed decision about whether to purchase cache.
For more information about trial cache, see “Request a Platform Cache Trial” in the Salesforce online help.
Platform Cache is also available for purchase. For more information about purchasing cache, see “Purchase Platform Cache” in the Salesforce online help.
For more information about Provider Free capacity cache, see “Set Up a Platform Cache partition using Provider Free Capacity” in the Salesforce online help.