This project is read-only.

Howto use the CacheProvider:

How-To add Data:

  • IndexusDistributionCache.CurrentProvider.Add(key, data, DateTime.Now.AddMinutes(10));

Retriving Data:

  • MyCachedObjectType obj = IndexusDistributionCache.CurrentProvider.Get<MyCachedObjectType>(key);

Removing Data:

  • IndexusDistributionCache.CurrentProvider.Remove(key);

Configuration for clients:

  • ConfigSection:
<configSections>
		<section name="nlog" type="NLog.Config.ConfigSectionHandler, NLog"/>
		<section name="indexusNetSharedCache" type="MergeSystem.Indexus.WinServiceCommon.Configuration.Client.IndexusProviderSection, MergeSystem.Indexus.WinServiceCommon"/>
	</configSections>

  • AppSettings
<appSettings>
		<!--Version Number, same like in assemblies-->
		<add key="SharedCacheVersionNumber" value="2.0.0.140" />
		<!--Should information be logged-->
		<add key="LoggingEnable" value= "1" />
		<!--Location of Cache Service-->
		<add key="ServiceCacheIpAddress" value= "127.0.0.1" />
		<!--Location of Cache Service, the port number-->
		<add key="ServiceCacheIpPort" value= "48888" />
		<!--
			Enable or disable compression upon client before transfer starts to server.
				Enable: 1
				Disable: 0			
		-->
		<add key="CompressionEnabled" value= "0" />
		<!--
			The user is able to set a min. size of its objects if the compression takes action or not.
			Size is defined in byte amount:
			  1kb = 1024
			 10kb = 10240
			hint 1: upon 0, every single payload will be compressed
			hint 2: upon negative numbers the compression will not work.
		-->
		<add key="CompressionMinSize" value= "10240" />
	</appSettings>

  • Provider rel. stuff:
best is if you put this direclty below appSettings element
	<indexusNetSharedCache defaultProvider="IndexusSharedCacheProvider">
		<servers>
			<!--<add key="SrvZh03"  ipaddress="127.0.0.1" port="48888" />-->
			<add key="SrvZh03"  ipaddress="127.0.0.1" port="48888" />
			<!--<add key="SrvZh02"  ipaddress="192.168.212.37" port="48888" />-->
		</servers>
		<providers>
			<add
        name="IndexusSharedCacheProvider"
        type="MergeSystem.Indexus.WinServiceCommon.Provider.Cache.IndexusSharedCacheProvider, MergeSystem.Indexus.WinServiceCommon"
           >
			</add>
		</providers>
	</indexusNetSharedCache>

  • Logging with NLog
	<nlog autoReload="true" throwExceptions="true">
		<targets async="true">
			<target name="shared_cache_general"		type="File" layout="${longdate}|${level:uppercase=true}|${aspnet-request:item=logSession}|${message}" filename="C:\temp\logs\client\${date:format=yyyy-MM-dd}_shared_cache_general_log.txt"/>
			<target name="shared_cache_traffic"		type="File" layout="${longdate}|${level:uppercase=true}|${aspnet-request:item=logSession}|${message}" filename="C:\temp\logs\client\${date:format=yyyy-MM-dd}_shared_cache_traffic_log.txt"/>
			<target name="shared_cache_tracking"	type="File" layout="${longdate}|${level:uppercase=true}|${aspnet-request:item=logSession}|${message}" filename="C:\temp\logs\client\${date:format=yyyy-MM-dd}_shared_cache_tracking_log.txt"/>
			<target name="shared_cache_sync"			type="File" layout="${longdate}|${level:uppercase=true}|${aspnet-request:item=logSession}|${message}" filename="C:\temp\logs\client\${date:format=yyyy-MM-dd}_shared_cache_sync_log.txt"/>
		</targets>
		<rules>
			<logger name="General" minlevel="Debug" writeTo="shared_cache_general" final="true"/>
			<logger name="Traffic" minlevel="Debug" writeTo="shared_cache_traffic" final="true"/>
			<logger name="Tracking" minlevel="Debug" writeTo="shared_cache_tracking" final="true"/>
			<logger name="Sync" minlevel="Debug" writeTo="shared_cache_sync" final="true"/>
			<logger name="*" minlevel="Debug" writeTo="shared_cache_general"/>
			<logger name="*" minlevel="Info" writeTo="shared_cache_general"/>
		</rules>
	</nlog>

Download

use this file as default config file client.config

Last edited Feb 13, 2008 at 7:16 PM by ronischuetz, version 10

Comments

No comments yet.