platform cache (df15 session)
TRANSCRIPT
Simple key-value programming model
• Just like interacting with a Map<String,Object>
• put(key, value); get(key); remove(key); contains(key);
• Type casting easily handled
Atomic Transactions
• Cache puts done at end of transaction
• “local cache” during transaction
• Data put to cache only if transaction succeeds
For sharing data that can be reused across your whole orgOrg Cache
A specialized version of org cache
• Same programming model
• User session ID logically appended to cache key
• TTL always is the user’s session
Eviction managed for you
• Time-To-Live (TTL)
• Least-recently used (LRU)
For retaining data throughout a user sessionSession Cache
To Make Your Application Faster
• Eliminate redundant expensive queries
• Eliminate redundant expensive calculations
• Stop overcrowding the Visualforce View State
To Make Application Development Easier
• Create structures in Apex
• Avoid the unique patterns for developing against Custom Settings
• No need to sweep for old stale data
Why Use Platform Cache?
Org Cache
• Data that is very likely to be needed again by multiple users
• Data that is expensive to re-create repeatedly
• Not data that can be retrieved by a simple SOQL query
• Data that is accessed frequently but changed infrequently
Session Cache
• Data that is very likely to be needed again across transactions throughout the session
• Data that is only needed in this particular user session
Hint: NOT ALWAYSWhen Do I Use Platform Cache?
Data put to the cache may not be there when you try to get it
• Application Server Shutdown
• Capacity Eviction
• Service Protection
Always expect to miss
• Builder Pattern
Consider what data belongs in the cache
• Shopping Cart: durable or not?
Consider what data does not belong in the cache
Platform Cache is NOT a durable storeWhere’s My Data?
Some for free
• 10MB for EE orgs
• 30MB for UE orgs
Some to buy
• 10MB increments
• Per-year subscription
ISV application-specific cache
• Restricted to a namespace
Temporary Free Trial
• How much should I buy?
To Avoid The Tragedy of the CommonsCash For Cache
Things we must protect:
• The Network
• Size of each stored value – serialized size
• Redis
• Number of keys
• Minimum partition size
Yes, Limits. Sorry.Limits?
Divide your cache space into the logical partitions that suit your needsPartitions
Service Cloud13MB
Shared Menus7MB
Sales Cloud10MB
Session Cache
8MB
Org Cache
5MB
Divide your cache space into the logical partitions that suit your needsPartitions
Service Cloud13MB
Shared Menus7MB
Sales Cloud40MB
Session Cache
8MB
Org Cache
5MB
Platform Cache can make your applications faster
Use Platform Cache where it makes sense
Do not abuse Platform Cache!
Platform Cache data is not durable – expect misses and handle them
Use partitions to manage churn
Purchase more Platform Cache space to improve your application performance
What To Remember