-
Notifications
You must be signed in to change notification settings - Fork 422
PlatformCacheRecipes
Illustrates how to programatically use the Platform Cache feature of Salesforce. Many of these recipes are, taken together, not very DRY (don't repeat yourself). However, they're intentionally listed here as a way of repeatedly demonstrating Platform Cache functionality
Group Platform Cache Recipes
Defines the default cache partition for use in this class.
These methods are for the Session Cache Max TTL for Session partion is 8 hours.
Stores a value in the Session cache with a custom timeout.
Param | Description |
---|---|
key |
key under which the value is saved. |
value |
value to store in the cache |
ttl |
Time To Live (ttl) is the number of seconds this item will remain in cache. |
Retrieves a value from the cache identified by key
Param | Description |
---|---|
key |
key of which value to retrieve. |
Type | Description |
---|---|
String |
the value |
removes a key/value from the cache manually
Param | Description |
---|---|
key |
key to remove |
Exception | Description |
---|---|
CacheException |
custom exception when key not found. |
These methods relate to the ORG cache Max TTL for Org Cache is 48 hours.
Stores a value in the Org cache with a custom timeout.
Param | Description |
---|---|
key |
key under which the value is saved. |
value |
value to store in the cache. |
ttl |
Time To Live (ttl) is the number of seconds this item will remain in cache. |
Retrieves a value from the cache identified by key
Param | Description |
---|---|
key |
key of which value to retrieve. |
Type | Description |
---|---|
String |
the value associated with the supplied key |
removes a key/value from the cache manually
Param | Description |
---|---|
key |
key to remove |
Exception | Description |
---|---|
CacheException |
custom exception when key not found. |
returns a partition for a given name, and type
Param | Description |
---|---|
type |
the partition type |
Type | Description |
---|---|
Cache |
the partition |
Enum for partition type.
internal custom exception class.
Inheritance
CacheException