<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technology Bits and Bytes &#187; srinivas.reddy</title>
	<atom:link href="http://blogs.circlesource.com/author/srinivasreddy/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.circlesource.com</link>
	<description>CircleSource Technical Talent ShowCase</description>
	<lastBuildDate>Thu, 10 Dec 2009 20:01:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Velocity Usages and its advantages</title>
		<link>http://blogs.circlesource.com/2009/01/20/velocity-usages-and-its-advantages/</link>
		<comments>http://blogs.circlesource.com/2009/01/20/velocity-usages-and-its-advantages/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 01:22:47 +0000</pubDate>
		<dc:creator>srinivas.reddy</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[microsoft distbruted velocity]]></category>
		<category><![CDATA[Microsoft distributed velocity]]></category>
		<category><![CDATA[velocity]]></category>
		<category><![CDATA[Velocity(Cache)]]></category>

		<guid isPermaLink="false">http://blogs.circlesource.com/?p=114</guid>
		<description><![CDATA[ 
 
Using Velocity and its advantages
 
It’s a distributed system. Velocity provides highly scalable distributed caching environment for Microsoft .net framework. By using this we can store frequently used data for faster access and also avoids unnecessary calls to the database. Velocity also supports optimistic and pessimistic locking as well as automatic load balancing.
We [...]]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong><span style="font-size: small;"><span style="font-family: Times New Roman;">Using Velocity and its advantages</span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">It’s a distributed system. Velocity provides highly scalable distributed caching environment for Microsoft .net framework. By using this we can store frequently used data for faster access and also avoids unnecessary calls to the database. Velocity also supports optimistic and pessimistic locking as well as automatic load balancing.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">We can use velocity either in windows application or web application.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Microsoft provides velocity in the form of a cluster. In this section we look at what are all those useful elements having cluster, how cluster works and some useful programming with velocity.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">In velocity one of the major element is named cache by using this we can store logical grouping of data like a database. A cluster can have any no of named caches. We can use one or more named caches in our applications. We can directly store objects in a cache without creating named cache. In this case those objects are stored in default named cache of the cluster.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">We can create or delete the cache using velocity administration tool</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Example: Create Cache CacheSample</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-tab-count: 1;"> </span><span style="mso-spacerun: yes;"> </span>Delete Cache CacheSample</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small; font-family: Times New Roman;">Here CacheSample is the name of the cache</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Another major (optional) element is regions. Actually regions are logical grouping of objects in a named cache like database tables. Regions provide additional searching capabilities. We can create any no of regions on a named cache. Regions are not possible to create using administration tool. We must be creating a region using explicitly run time using application. </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">We can also check what are all those regions inside the caches and regions available in a cluster using this below command</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Example:<strong> </strong>List Host CacheSample</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Velocity allows blindly any time of CLR serialized object in the form of key value pairs</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Regions can store any no of objects but depend on size of cluster installation. Anyway once we are added object in a cache that object resides in a cache including version, time to live (TTL) and tags.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong><span style="font-size: small;"><span style="font-family: Times New Roman;">The below example describes how to add item to the cache and get the item from cache.</span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong><span style="font-size: small; font-family: Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><strong>Step 1 </strong>First run velocity setup and then references the following .dll from the Program Files\Microsoft Distributed Cache folder: CacheBaseLibrary.dll, ClientLibrary.dll, FabricCommon.dll, CASBase.dll, and CASClient.dll to visual studio .net project.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><strong>Step 2</strong> We also need to add the below configuration information to app.Config file or Web.Config file.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Example:</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">configSections</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">section</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">name</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">dcacheClient</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">type</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">System.Configuration.IgnoreSectionHandler</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">allowLocation</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">true</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">allowDefinition</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">Everywhere</span>&#8220;<span style="color: blue;"> /&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">section</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">name</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">fabric</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">type</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">System.Fabric.Common.ConfigFile, FabricCommon</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">allowLocation</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">true</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">allowDefinition</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">Everywhere</span>&#8220;<span style="color: blue;"> /&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&lt;/</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">configSections</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">dcacheClient</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">deployment</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">simple</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">localCache</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">false</span>&#8220;<span style="color: blue;">&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">hosts</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;!&#8211;</span><span style="font-size: 10pt; color: green; mso-no-proof: yes;">List of hosts </span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&#8211;&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">host</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">name</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;NameOfCacheServerSystem&#8221;<span style="color: blue;"> </span><span style="color: red;">cachePort</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">22233</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">cacheHostName</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">DistributedCacheService</span>&#8220;<span style="color: blue;"> /&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">hosts</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&lt;/</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">dcacheClient</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">fabric</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">section</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">name</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">logging</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">path</span><span style="color: blue;">=</span>&#8220;&#8221;<span style="color: blue;">&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">collection</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">name</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">sinks</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">collectionType</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">list</span>&#8220;<span style="color: blue;">&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">customType</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">className</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">System.Fabric.Common.EventLogger,FabricCommon</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">sinkName</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">System.Fabric.Common.ConsoleSink,FabricCommon</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">sinkParam</span><span style="color: blue;">=</span>&#8220;&#8221;<span style="color: blue;"> </span><span style="color: red;">defaultLevel</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">-1</span>&#8220;<span style="color: blue;"> /&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">customType</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">className</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">System.Fabric.Common.EventLogger,FabricCommon</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">sinkName</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">System.Fabric.Common.FileEventSink,FabricCommon</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">sinkParam</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">CacheClientLog</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">defaultLevel</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">1</span>&#8220;<span style="color: blue;"> /&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">customType</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"> </span><span style="font-size: 10pt; color: red; mso-no-proof: yes;">className</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">=</span><span style="font-size: 10pt; mso-no-proof: yes;">&#8220;<span style="color: blue;">System.Fabric.Common.EventLogger,FabricCommon</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">sinkName</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">System.Data.Caching.ETWSink, CacheBaseLibrary</span>&#8220;<span style="color: blue;"> </span><span style="color: red;">sinkParam</span><span style="color: blue;">=</span>&#8220;&#8221;<span style="color: blue;"> </span><span style="color: red;">defaultLevel</span><span style="color: blue;">=</span>&#8220;<span style="color: blue;">-1</span>&#8220;<span style="color: blue;"> /&gt;</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">collection</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">section</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: blue; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>&lt;/</span><span style="font-size: 10pt; color: #a31515; mso-no-proof: yes;">fabric</span><span style="font-size: 10pt; color: blue; mso-no-proof: yes;">&gt;</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><strong><span style="font-size: small; font-family: Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><strong>Step 3</strong> Needs to create a named cache from velocity administration tool</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small; font-family: Times New Roman;">Create Cache CacheSample</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small; font-family: Times New Roman;">Here ‘CacheSample’ is the named cache.</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><strong>Step 4 </strong>Create<strong> </strong>the instance of the cache factory class and get the named cache from that instance.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">CacheFactory cacheFactory = new CacheFactory();</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;">Cache cache = <span style="mso-no-proof: yes;">cacheFactory</span>.GetCache(&#8220;CacheSample &#8220;);</span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><strong>Step 5 </strong>create the region </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;">cache<span style="mso-no-proof: yes;">.CreateRegion(“SampleRegion”,true); </span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><strong>Step 6<span style="mso-no-proof: yes;"> </span></strong>Add<span style="mso-no-proof: yes;"> </span>the item(object) to the region<span style="mso-no-proof: yes;"> </span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">We can add any CLR serialized object by using Add and Put methods.The main difference between Add and Put is Add will throw an error if given key is already exists but put will not throw any exception if the given key is already exists its replace with newer one. On the other hand if the given key is does not exist the object will be added to the cluster.</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">ADD Method</span></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Name of the region in a named cache</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Key for uniquely identify the<span style="mso-spacerun: yes;"> </span>cache object</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Cached object(in this case ds)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Searchable information</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Version information</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Time to alive in cache interms of minutes</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small;"><span style="font-family: Times New Roman;">cache.<span style="mso-no-proof: yes;">Add(“SampleRegion”, “Id”, ds, searchInfo,15);</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">Put Method</span></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Name of the region in a named cache</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Key for uniquely identify the<span style="mso-spacerun: yes;"> </span>cache object</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Cached object(in this case ds)</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Searchable information</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Version information</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Time to alive in cache interms of minutes</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: small;"><span style="font-family: Times New Roman;">cache<span style="mso-no-proof: yes;">.Put(“SampleRegion”, “Id”, ds, searchInfo, null, 15);</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">Get Method</span></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Name of the region in a named cache</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Key for uniquely identify the<span style="mso-spacerun: yes;"> </span>cache object</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// It returns a cache Item Object. </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// That need to cast into appropriate type</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">CacheItem item = cache.GetCacheItem(“SampleRegion”, “Id”)</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="font-size: small; font-family: Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="font-size: small;"><span style="font-family: Times New Roman;">Remove the item from Cache</span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><strong><span style="font-size: small; font-family: Times New Roman;"> </span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">Remove method deletes object with specified key from the cache.<span style="mso-spacerun: yes;"> </span></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;"> </span></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; tab-stops: list .75in;"><span style="font-family: Times New Roman;"><strong><span style="mso-no-proof: yes;"><span style="mso-list: Ignore;"><span style="font-size: small;">1.</span><span style="font: 7pt &quot;Times New Roman&quot;;"> </span></span></span></strong><strong><span style="mso-no-proof: yes;"><span style="font-size: small;">Remove the object with specified key from cache</span></span></strong></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-family: Times New Roman;"><span style="mso-no-proof: yes;"><span style="mso-spacerun: yes;"><span style="font-size: small;"> </span></span></span><span style="font-size: 10pt; color: green; mso-no-proof: yes;">// Unique key associated with the object.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;"> </span><span style="mso-tab-count: 1;"> </span>cache.Remove(“Id”);</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-tab-count: 1;"> </span></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;"> </span><span style="mso-tab-count: 1;"> </span><strong><span style="mso-spacerun: yes;"> </span>2. Removes the Object with specified key from specified region</strong></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;"> </span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Name of the region, cannot be null.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-family: Times New Roman;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;">// Unique key associated with the object</span><span style="mso-no-proof: yes;"><span style="font-size: small;">.</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;">cache.Remove(“SampleRegion”, “Id”);</span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;"> </span></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><strong><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;"> </span><span style="mso-tab-count: 1;"> </span>3. Drop the region with the specified name.</span></span></span></strong></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; mso-layout-grid-align: none;"><span style="mso-no-proof: yes;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><span style="mso-spacerun: yes;"> </span></span></span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// Name of the region, cannot be null.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt; text-indent: 0.5in;"><span style="font-size: 10pt; color: green; mso-no-proof: yes;"><span style="font-family: Times New Roman;">// If it returns true then successful other wise returns false.</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt 0.5in;"><span style="mso-no-proof: yes;"><span style="font-size: small; font-family: Times New Roman;">Cache.RemoveRegion(string region);</span></span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-size: small; font-family: Times New Roman;"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.circlesource.com/2009/01/20/velocity-usages-and-its-advantages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
