PorfolioExplorer.cs :: public void LoadDataFromRootFundComboBox()
{
...
LoadData(SelectedGroup);
cacheCluster = new DataCacheServerEndpoint[1];
cacheCluster[0] = new DataCacheServerEndpoint(
"jqdappfabric",
// "10.32.68.131",
22233);
DataCacheFactoryConfiguration cfg = new DataCacheFactoryConfiguration();
cfg.Servers = cacheCluster;
DataCacheFactory factory = new DataCacheFactory(cfg);
cache = factory.GetDefaultCache();
try
{
if (EventEngine.Instance.CurrentHoldingComposite != null)
cache.Put("CurrentHoldingComposite", EventEngine.Instance.CurrentHoldingComposite, new TimeSpan(240, 0, 0));
if (EventEngine.Instance.RootFund != null)
cache.Put("RootFund", EventEngine.Instance.RootFund, new TimeSpan(240, 0, 0));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
DataCacheFactory factory;
DataCache cache;
DataCacheServerEndpoint[] cacheCluster;
AppConfig
=========
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient" type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,
Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowLocation="true" allowDefinition="Everywhere"/>
<dataCacheClient>
<transportProperties maxBufferPoolSize="7" maxBufferSize="2000000000"/>
<!-- (optional) specify local cache
<localCache
isEnabled="true"
sync="TimeoutBased"
objectCount="100000"
ttlValue="300" /> -->
<!--(optional) specify cache notifications poll interval
<clientNotification pollInterval="300" /> -->
<hosts>
<host name="jqdappfabric" cachePort="22233"/>
<!--name="CacheServer2"
cachePort="22233"/>-->
</hosts>
</dataCacheClient>
Note that there are 2 DLL from server that can be used on XP ( only suppoed to installed to Win7 but it works
Microsoft.ApplicationServer.Caching.Client.dll
Microsoft.ApplicationServer.Caching.Core.dll
The other two may be useful:
Microsoft.WindowsFabric.Common.dll
Microsoft.WindowsFabric.Data.Common.dll
Wednesday, March 30, 2011
App Fabric Caching Client Code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment