How to Control the Profile Cache

I was Recently asked about, how do you control the Profile Cache? This post will answer this question.

Profile Cache

The ProfileService cache differs from other caches in Commerce Server because it does not use the ASP.NETcomponent nor is it configurable in the web.config. Instead, it includes its own built-in cache of profile objects. This cache cannot be disabled.

You control when the Profiling System refreshes and how often. You can configure the ProfileService cache using the following properties in the Profiling System connection string:

  • PsObjectCacheSize [optional]. Allows applications to specify the size of the Profiles resource object cache. This cache stores ProfileObject objects instantiated by the CreateProfile and GetProfile methods. The default value for this attribute is 16384. Setting this value to 0 (zero) does not turn off caching. Instead, this value then reverts to the default value of 1024.
  • PsSchemaCacheSize [optional]. Allows applications to specify the size of the Profile resource definition (schema) cache in entries. The acceptable range of values is from one (1) to 1024. The default is 1024. This is not a hard limit. A warning will be posted to the eventlog if the number of entries exceeds 1024.
  • PsBackgroundThread [optional]. Allows applications to control the creation of a background thread to periodically clean up entries from the Profiles resource object cache. The acceptable values for this parameter are zero (0) or one (1). Zero turns off the background thread, one turns it on. By default, the background thread is on.
  • PsObjectAgeoutPeriod [optional]. Allows applications to specify the age-out period for the Profiles resource cache entries. The age-out period is the amount of time an unreferenced object can remain in the cache without being discarded. The default value for this attribute is five minutes.
  • Connection_Retry [optional]. Allows the applications to specify the number of retry attempts if the connection to the Profile definition store is lost due to a communication failure. The default value for this attribute is 10.
  • Connection_Retry_Delay [optional]. Allows the applications to specify the delay in seconds between retry attempts if the connection to the Profile definition store is lost due to a communication failure. The default value for this attribute is 30.

For more details see the following help file:

ProfileService Object
IProfileService2::Initialize Method
Using Profiles in a Web Farm Scenario.