Speed is a critical factor in customer experience (CX) because it directly influences how customers perceive and interact with a brand. Speed assists customers with Immediate Gratification, reduce frustration and builds goodwill and trust among customers. Same day deliveries and updates are expectations of customers. Speed also helps businesses with competitive advantages and build a reputation of valuing other’s time.
Cache is an optimization technique in computing to store frequently accessed data or computations for quicker retrieval. By reducing the need to repeatedly access slower memory or perform redundant calculations, caching can significantly improve performance. Figure – 1 indicates the time taken to query all leads in the system without cache enabled and Figure – 2 indicates the time taken to query all leads with cache enabled. On comparison, when cached, the response time is reduced by 30%.
Salesforce Omnistudio, a modern low code development platform has improved cache to improve the speed of response. In Salesforce there are two types of cache, namely Scale Cache and Platform Cache (Setup > Platform Cache). Depending on the Salesforce edition cache capacity is provided as shown below:
Edition | Cache Size |
Enterprise Edition | 10 MB by default |
Unlimited Edition | 30 MB by default |
Performance Edition | 30 MB by default |
All other editions | 0 MB |
While there is a temptation to store all the data in cache, it is imperative to understand what data needs to be stored in cache. The data to be cached must have the following characteristics:
Salesforce Omnistudio Cache
In Omnistudio Integration Procedures (IP) and Data Mappers (DM) perform extract and DML operations and can use the platform cache. Omnistudio uses scale cache or platform cache. Scale Caching occurs automatically, and the only way to stop using scale caching is to turn off the scale caching. To use platform cache, space in VlocityMetadata must be enabled for automatic caching.
To Turn off the scale, do the following:
Additionally, if the metadata of the IP and DM need to be cached, then a partition in VlocityMetadata cache must be allocated. Caching of IPs and DMs that are frequently accessed improves response time. CheckCachedMetadataRecordSecurity setting must be set to true to enforce the sharing settings on cached data.
Data Mapper (DM)
Data Mappers are cached, depending on the settings. However, if the Data Mapper is called from an Integration Procedure that has caching enabled, then Data Mapper will always be cached. Options tab in Data Mapper can be used to cache the Data Mapper as shown in the following figure.
If DM cache is not refreshed automatically then the following setting must be enabled:
Setup > Custom Settings > Trigger Setup > AllTriggers is on
To clear the DM scale cache, the following code must be executed:
omnistudio.ScaleCacheService.invalidateCacheValue(new Map<String, String>{‘DataMapperId’ => ‘ExtractContactName’}); //ExtractContactName is the name of the DM.
Integration Procedure (IP)
Caching of IP provides different options. The entire IP can be cached, the full response of the IP can be cached, or part of the IP response can be cached using the Cache blocks. To clear the IP from the cache, please use the following code: omnistudio.IntegrationProcedureService.clearAllCache(‘Type_Subtype’);
If Omnistudio is using the Scale cache, then the method omnistudio.ScaleCacheService.invalidateCacheValue(new Map<String, String>{‘VIPId’ => ‘LoopList_ContactNames’}); is used to clear the cache. ‘LoopList_ContactNames’ is the Type_SubType of the Integration Procedure (IP).