Set all cached object timeout from config file

#1
Is there any configuration available in soss to set cached object time out either from web.config,soss_client_params or soss_params ?
Like ttlValue available in App-fabric :
Code:
  <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/>
 

admin

Administrator
#1
The SOSS client library does not load any default settings from app.config by itself but it is trivial to do this in your own application code:
  • Add a reference to System.Configuration to your project if you haven’t already.
  • Add a new appSetting to your app.config file: <configuration><appSettings><add key=”sossTimeoutInMinutes” value=”60” />
  • Add the following using statements to your source code file:
    Code:
    using System.Configuration;
    using System.Globalization;
  • In your code, use this: myCache.DefaultCreatePolicy.TimeoutMinutes = Int32.Parse( ConfigurationManager.AppSettings[“sossTimeoutInMinutes”], CultureInfo.InvariantCulture );
You may want to cache the values in static state to improve performance too, so Int32.Parse isn’t invoked all the time, like so:
Code:
private static int _sossTimeoutInMinutes = Int32.Parse( ConfigurationManager.AppSettings[“sossTimeoutInMinutes”], CultureInfo.InvariantCulture );
// …
myCache.DefaultCreatePolicy.TimeoutMinutes = _sossTimeoutInMinutes;
 
Top