In Use AB_Cache to store state information objects for a short time the low-level interface for creating and using AB_Cache is documented. To use the low-level interface, caching properties must be hardcoded or otherwise provided.
AB_ConfiguredCacheCollection allows a set of caching properties to be defined in a configuration file, and then one or more AB_Caches can be instantiated using those properties.
Usage - Set up Cache:
// Set up static service-side cache for holding custom field definitions protected static AB_ConfiguredCacheCollection ap_WorkflowCaches = new AB_ConfiguredCacheCollection { }; // Get the custom fields cache; if the cache is disabled this will return null protected static AB_Cache ap_CustomFieldsCache { get { return ap_WorkflowCaches["CustomFieldsCache"]; } }
The string used as an index on ap_WorkflowCaches is used to find the configuration entries. For this pool we're setting a 10 minute sliding expiration policy.
Configuration:
<add key="Feature.CustomFieldsCache.IsDisabled" value="False"/> <add key="Feature.CustomFieldsCache.CacheMemoryLimitMegabytes" value="0"/> <add key="Feature.CustomFieldsCache.PhysicalMemoryLimitPercentage" value="0"/> <add key="Feature.CustomFieldsCache.PollingInterval" value="00:02:00"/> <add key="Feature.CustomFieldsCache.SlidingExpiration" value="00:10:00"/>