Platform Cache

Platform Cache

Welcome back !!! We came back in 2020 after a great success of Apex Hours in 2019. In our very first session of 2020 we will talk about Platform Cache in Salesforce. In this session we will talk about how to Boost your app‘s performance significantly and Understand which kind of data to put in the cache. Know the obstacles when you use to the platform cache and prepare for cache misses and unexpected results.

Happy New Year !!!

Here is Agenda of session :-

  • Concepts
  • Use cases and data worth caching
  • Implementation as a key /value storage
  • Implementation as read-through Cache
  • Considerations
Topic    : Platform Cache

Date     : Saturday, JAN 04, 2020 10:00 AM EST ( 8:30 PM IST )

Where : Online

RSVP   : https://trailblazercommunitygroups.com/e/m5rmk7/

 

Considerations.

Where‘s the catch?

  1. It‘s still a cache, not a database.
  2. It is short lived and per default visible and mutable
  3. Understand the key concepts of the platform cache (in particular TTL, LRU)
  4. Expect the cache to fail you.
  5. What’s your strategy to invalidate cache?
  6. The Cache will go away... Schedule a Cache Rebuild < TTL
  7. Cached items will be pushed out… Use the CacheBuilder interface
  8. Cached data goes stale… Rebuild From Triggers
  9. Cached items must adhere to the 100kB size limits Reduce memory footprint by using Apex Classes instead of sObject or reduce the number of queried fields
  10. Don‘t use the cache as a fast, limit-free database.
  11. Don‘t use it as temporary storage for transactional data
  12. No items larger than 100kB
  13. Cached Items are not persisted – don‘t rely on them being there.
  14. Unless flagged as immutable, don’t rely on the integrity of cached items

Best Practices :-

  1. Cache lists or maps of objects rather than single objects.Tradeoff: Better performance of fewer, larger operations vs. 100kB item size limit
  2. Use a wrapper class to reduce sObject overhead
  3. Use the fully qualified name of your cache partition
  4. Consider using the ‘immutable‘ flag and the visibility enum

Here is recording of session.

Here is PPT of session.

 

Further Reading

  1. Developer Documentation: bit.ly/cachedoc
  2. Trailhead: bit.ly/cachetrail
  3. Session Code: github.com/dstdia/PlatformCache/
  4. Keir Bowden’s blog post: bit.ly/cache-buzzard
  5. Josh Kaplan‘s blog post: bit.ly/cache-sfblog
  6. Amit Chaudhary: http://bit.ly/cache-amit

 

Please note that we have limit of 300 attendees that can join the online sessions. However, recording will be posted on our YouTube channel. Make sure to subscribe our YouTube channel to get notification for video upload.

Bookmarks our “Session in 2020” page for all upcoming and old sessions of 2020. Let us know which topic you want learn next in ApexHours.

Sharing is Caring so Share with your friends

 

Thanks,
Salesforce Apex Hours

Leave a Comment