Using a Combination of Local AppFabric Cache and Server Cache

I'm just starting to use AppFabric ...

My healthcare application - we have about 15,000 users of the system, and they gain access to patient information during surges (for example, think of a team of nurses / doctors visiting the patient when they are hospitalized).

What I would like to do is cache certain elements (for example, patient demographic information) in memory and other items (for example, laboratories, medications, diagnostic images, reports) on the host server. The main data comes from various third-party systems, some of which are extremely slow to return data.

Does anyone know if it is possible to indicate that some elements enter the local cache, while others go to the server? There is too much data in memory. When viewing the MSDN documentation, an example configuration file is provided.

<dataCacheClient requestTimeout="15000" channelOpenTimeout="3000" maxConnectionsToServer="1"> <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/> <clientNotification pollInterval="300" maxQueueLength="10000"/> <hosts> <host name="CacheServer1" cachePort="22233"/> <host name="CacheServer2" cachePort="22233"/> </hosts> <securityProperties mode="Transport" protectionLevel="EncryptAndSign" /> <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456" maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000" receiveTimeout="600000"/> </dataCacheClient> 

It seems like turning on the local cache for the entire cache client?

To support the described scenario, does this mean that I will need to create two cache clients, and my code will need to know / know which client I need to paste the data into? Or is there an API / flag / parameter that I can use while storing data in the cache? Or maybe with the help of regions / tags?

Thanks!

+4
source share
1 answer

Assuming you are using AppFabric 1.1, you can configure multiple dataCacheClient nodes with different configurations. Therefore, using your existing example, you would do something like:

 <!-- local caching client --> <dataCacheClient name="LocalCaching" requestTimeout="15000" channelOpenTimeout="3000" maxConnectionsToServer="1"> <localCache isEnabled="true" sync="TimeoutBased" ttlValue="300" objectCount="10000"/> <clientNotification pollInterval="300" maxQueueLength="10000"/> <hosts> <host name="CacheServer1" cachePort="22233"/> <host name="CacheServer2" cachePort="22233"/> </hosts> <securityProperties mode="Transport" protectionLevel="EncryptAndSign" /> <transportProperties connectionBufferSize="131072" maxBufferPoolSize="268435456" maxBufferSize="8388608" maxOutputDelay="2" channelInitializationTimeout="60000" receiveTimeout="600000"/> 

Then from the code, you have another DataCacheFactoryConfigurations , using a constructor that takes a name instead of just using the default value:

 DataCacheFactoryConfiguration localCachingFactoryConfig = new DataCacheFactoryConfiguration("LocalCaching"); DataCacheFactoryConfiguration remoteOnlyCachingFactoryConfig = new DataCacheFactoryConfiguration("RemoteOnlyCaching"); 

Then you simply create DataCache instances from the appropriate factory code according to the type of caching that is required for the data you are working with.

+2
source

Source: https://habr.com/ru/post/1440647/


All Articles