<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Alex Tsung's Weblog &#187; C#</title>
	<atom:link href="http://atsung.wordpress.com/category/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://atsung.wordpress.com</link>
	<description>ASP.NET related</description>
	<lastBuildDate>Thu, 04 Jun 2009 07:09:30 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='atsung.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/d03430f7c9167f70228686d34687eb35?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Alex Tsung's Weblog &#187; C#</title>
		<link>http://atsung.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://atsung.wordpress.com/osd.xml" title="Alex Tsung&#8217;s Weblog" />
		<item>
		<title>Wishlist for Velocity (CPT4?)</title>
		<link>http://atsung.wordpress.com/2009/06/04/wishlist-for-velocity-cpt4/</link>
		<comments>http://atsung.wordpress.com/2009/06/04/wishlist-for-velocity-cpt4/#comments</comments>
		<pubDate>Thu, 04 Jun 2009 07:08:55 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Distribued Cache]]></category>
		<category><![CDATA[Velocity]]></category>
		<category><![CDATA[Distributed Cache]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=156</guid>
		<description><![CDATA[I went to Rob&#8217;s presentation on Velocity tonight, it&#8217;s a great presentation and a lot of information shared with audience.
I prepare a wishlist for Velocity (CPT4 or next beta release) and hope the Velocity team can take my wishlist into consideration.

A new method: bool DataCache.ContainsRegion(string region).

This method checks if the region exists in the named [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=156&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I went to <a href="http://weblogs.asp.net/rchartier/" target="_blank">Rob</a>&#8217;s <a href="http://tinyurl.com/RobVelocity" target="_blank">presentation on Velocity</a> tonight, it&#8217;s a great presentation and a lot of information shared with audience.</p>
<p>I prepare a wishlist for Velocity (CPT4 or next beta release) and hope the Velocity team can take my wishlist into consideration.</p>
<ol>
<li>A new method: <span style="color:#ff6600;">bool DataCache.ContainsRegion(string region)</span>.
<ul>
<li>This method checks if the region exists in the named cache or not.</li>
<li>See my <a href="http://atsung.wordpress.com/2009/06/01/velocity-how-do-i-know-if-a-cache-region-is-created/" target="_blank">previous post</a> for details.</li>
</ul>
</li>
<li>Update the method <span style="color:#ff6600;">DataCache.GetObjectsByAnyTag(List&lt;DataCacheTag&gt; tags, string region)</span> so the keys of returned cache items are unique.
<ul>
<li>Make sure the cache key is not contained in the keys, then add the item into the collection.</li>
<li>See my <a href="http://atsung.wordpress.com/2009/06/01/velocity-ctp3-datacache-getobjectsbyanytag-method/" target="_blank">previous post</a> for example.</li>
</ul>
</li>
<li>Make sure the default region name is not arbitratry.
<ul>
<li><span style="color:#ff6600;">DataCache.GetCacheItem</span> Method &#8211; Gets a <span style="color:#ff6600;">DataCacheItem</span> object to retrieve all information associated with your cached object in the cluster.</li>
<li><span style="color:#ff6600;">DataCache.GetCacheItem (String)</span> -&gt; Gets a DataCacheItem object to retrieve all information associated with your cached object in the cluster.</li>
<li><span style="color:#ff6600;">DataCache.GetCacheItem (String, String)</span> -&gt; Gets a DataCacheItem object to retrieve all information associated with your cached object in the cluster. For objects stored in regions.</li>
<li>When using the <span style="color:#ff6600;">DataCache.GetCacheItem (String)</span> method (without region specified), the return object&#8217;s property -<span style="color:#ff6600;">RegionName</span> &#8211; is kind of arbitrary.</li>
</ul>
</li>
<li>A new commad for administrators to create region in PowerShell.
<ul>
<li><span style="color:#ff6600;">New-CacheRegion [-CacheName] &lt;CacheName&gt; [-RegionName] &lt;RegionName&gt;</span></li>
<li>Example 1:
<ul>
<li>New-CacheRegion -CacheName Products -RegionName MyRegion -&gt; this creates a region &#8220;MyRegion&#8221; in the named cache &#8220;Products&#8221;.</li>
</ul>
</li>
<li>Example 2:
<ul>
<li>New-CacheRegion -RegionName MyRegion -&gt; this creates a region &#8220;MyRegion&#8221; in the default cache &#8220;default&#8221;</li>
</ul>
</li>
</ul>
</li>
</ol>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=156&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/06/04/wishlist-for-velocity-cpt4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>
	</item>
		<item>
		<title>Velocity (CTP3) &#8211; DataCache.GetObjectsByAnyTag Method</title>
		<link>http://atsung.wordpress.com/2009/06/01/velocity-ctp3-datacache-getobjectsbyanytag-method/</link>
		<comments>http://atsung.wordpress.com/2009/06/01/velocity-ctp3-datacache-getobjectsbyanytag-method/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 01:35:43 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Distribued Cache]]></category>
		<category><![CDATA[Velocity]]></category>
		<category><![CDATA[CTP3]]></category>
		<category><![CDATA[Data Cache]]></category>
		<category><![CDATA[Distributed Cache]]></category>
		<category><![CDATA[GetObjectsByAnyTag]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=126</guid>
		<description><![CDATA[I was writing some code to experiment the Tag search in Velocity CTP3 and I found there is some small bug in one of the get objects by tag methods &#8211; DataCache.GetObjectsByAnyTag.
The definition of the method of DataCache.GetObjectsByAnyTag is:
Gets an enumerable list of all cached objects in the specified region that have any of the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=126&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was writing some code to experiment the Tag search in Velocity CTP3 and I found there is some small bug in one of the get objects by tag methods &#8211; <em>DataCache.GetObjectsByAnyTag</em>.</p>
<p>The definition of the method of <em>DataCache.GetObjectsByAnyTag</em> is:</p>
<p><span style="color:#000000;"><span style="text-decoration:underline;"><span style="color:#ff6600;">Gets an enumerable list of all cached objects in the specified region that have any of the same tags in common.</span></span></span></p>
<p>For example I have 3 cache items:</p>
<p>Item 1: key = &#8220;111&#8243;, content = &#8220;aaa&#8221;, tag = &#8220;a&#8221;</p>
<p>Item 2: key = &#8220;222&#8243;, content = &#8220;bbb&#8221;, tag = &#8220;b&#8221;</p>
<p>Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</p>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Here are some scenarios:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">(1) If I search with Tag &#8220;a&#8221; via DataCache.GetObjectsByAnyTag(&lt;a&gt;, &#8220;my_region&#8221;), I get:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 1: key = &#8220;111&#8243;, content = &#8220;aaa&#8221;, tag = &#8220;a&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">(2) If I search with Tag &#8220;b&#8221; via DataCache.GetObjectsByAnyTag(&lt;b&gt;, &#8220;my_region&#8221;), I get:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 2: key = &#8220;222&#8243;, content = &#8220;bbb&#8221;, tag = &#8220;b&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">(3) But if I search with Tags &#8220;a,b&#8221; via DataCache.GetObjectsByAnyTag(&lt;a, b&gt;, &#8220;my_region&#8221;), I get:</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 1: key = &#8220;111&#8243;, content = &#8220;aaa&#8221;, tag = &#8220;a&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Item 2: key = &#8220;222&#8243;, content = &#8220;bbb&#8221;, tag = &#8220;b&#8221;</div>
<p>Here are some scenarios:</p>
<p><strong>(1)</strong> If I search with Tag &#8220;a&#8221; via DataCache.GetObjectsByAnyTag(&lt;a&gt;, &#8220;my_region&#8221;), I get:</p>
<p>Item 1: key = &#8220;111&#8243;, content = &#8220;aaa&#8221;, tag = &#8220;a&#8221;</p>
<p>Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</p>
<p><strong>(2)</strong> If I search with Tag &#8220;b&#8221; via DataCache.GetObjectsByAnyTag(&lt;b&gt;, &#8220;my_region&#8221;), I get:</p>
<p>Item 2: key = &#8220;222&#8243;, content = &#8220;bbb&#8221;, tag = &#8220;b&#8221;</p>
<p>Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</p>
<p><strong>(3)</strong> But if I search with Tags &#8220;a,b&#8221; via DataCache.GetObjectsByAnyTag(&lt;a, b&gt;, &#8220;my_region&#8221;), I get:</p>
<p>Item 1: key = &#8220;111&#8243;, content = &#8220;aaa&#8221;, tag = &#8220;a&#8221;</p>
<p>Item 2: key = &#8220;222&#8243;, content = &#8220;bbb&#8221;, tag = &#8220;b&#8221;</p>
<p>Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</p>
<p>Item 3: key = &#8220;333&#8243;, content = &#8220;ccc&#8221;, tag = &#8220;a,b,c&#8221;</p>
<p>In scenario <strong>(3)</strong>, the item 3 has been added twice because its tags are &#8220;a,b,c&#8221; and I search by &lt;a,b&gt; (Any Tag).</p>
<p>I believe this method - <em>DataCache.GetObjectsByAnyTag - <span style="font-style:normal;"><span style="text-decoration:underline;"><span style="color:#ff6600;"><span style="font-style:normal;"><span style="text-decoration:none;">should check if the cache key is contained in the collection, if not, then add it to the collection</span></span></span></span></span><span style="font-style:normal;"> &#8211; unless the velocity team want the developers do the checking of duplicated key in the caller program.</span></em></p>
<p>I will list my code and some screenshots.</p>
<p><em><span style="font-style:normal;">The first file is CacheWorker.cs:</span></em></p>
<div style="font-family:Courier New;font-size:9pt;color:black;background:white;">
<p style="margin:0;"><span style="color:blue;">using</span> System;</p>
<p style="margin:0;"><span style="color:blue;">using</span> Microsoft.Data.Caching;</p>
<p style="margin:0;">
<p style="margin:0;"><span style="color:blue;">namespace</span> VelocityTest</p>
<p style="margin:0;">{</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">CacheWorker</span></p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">const</span> <span style="color:blue;">string</span> DEFAULT_CACHE_REGION = <span style="color:#a31515;">&#8220;Default_Cache_Region&#8221;</span>;</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:blue;">object</span> _synclock = <span style="color:blue;">new</span> <span style="color:blue;">object</span>();</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">CacheWorker</span> _cacheWorker = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCacheFactory</span> _cacheFactory = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCache</span> _defaultCache = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCache</span> _eventCache = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> CacheWorker()</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">CacheWorker</span> Instance</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span></p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">lock</span> (_synclock)</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">try</span></p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">if</span> (_cacheWorker == <span style="color:blue;">null</span>)</p>
<p style="padding-left:180px;margin:0;">{</p>
<p style="padding-left:210px;margin:0;">_cacheWorker = <span style="color:blue;">new</span> <span style="color:#2b91af;">CacheWorker</span>();</p>
<p style="padding-left:210px;margin:0;">
<p style="padding-left:210px;margin:0;"><span style="color:green;">// we use configuration file</span></p>
<p style="padding-left:210px;margin:0;">_cacheFactory = <span style="color:blue;">new</span> <span style="color:#2b91af;">DataCacheFactory</span>();</p>
<p style="padding-left:210px;margin:0;">
<p style="padding-left:210px;margin:0;"><span style="color:green;">// default cache</span></p>
<p style="padding-left:210px;margin:0;">_defaultCache = _cacheFactory.GetDefaultCache();</p>
<p style="padding-left:210px;margin:0;">
<p style="padding-left:210px;margin:0;">_defaultCache.RemoveRegion(DEFAULT_CACHE_REGION);</p>
<p style="padding-left:210px;margin:0;">_defaultCache.CreateRegion(DEFAULT_CACHE_REGION, <span style="color:blue;">true</span>);</p>
<p style="padding-left:210px;margin:0;">
<p style="padding-left:210px;margin:0;"><span style="color:green;">// names cache</span></p>
<p style="padding-left:210px;margin:0;">_eventCache = _cacheFactory.GetCache(<span style="color:#a31515;">&#8220;Event2&#8243;</span>);</p>
<p style="padding-left:180px;margin:0;">}</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">return</span> _cacheWorker;</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">catch</span> (<span style="color:#2b91af;">DataCacheException</span> ex)</p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">return</span> <span style="color:blue;">null</span>;</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">DataCacheFactory</span> CacheFactory</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span> { <span style="color:blue;">return</span> _cacheFactory; }</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">DataCache</span> DefaultCache</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span> { <span style="color:blue;">return</span> _defaultCache; }</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">DataCache</span> EventCache</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span> { <span style="color:blue;">return</span> _eventCache; }</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">DataCacheItemVersion</span> AddCache(<span style="color:blue;">string</span> key, <span style="color:blue;">object</span> value, <span style="color:#2b91af;">TimeSpan</span>? timeout)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:#2b91af;">DataCacheItemVersion</span> version = <span style="color:blue;">null</span>;</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (timeout.HasValue)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">version = _defaultCache.Put(key, value, timeout.Value);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">else</span></p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">version = _defaultCache.Put(key, value);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;"><span style="color:blue;">return</span> version;</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">}</p>
<p style="margin:0;">}</p>
</div>
<p>The second file is Default3.aspx page:</p>
<div style="font-family:Courier New;font-size:9pt;color:black;background:white;">
<p style="margin:0;"><span style="background:#ffee62;">&lt;%</span><span style="color:blue;">@</span> <span style="color:#a31515;">Page</span> <span style="color:red;">Language</span><span style="color:blue;">=&#8221;C#&#8221;</span> <span style="color:red;">AutoEventWireup</span><span style="color:blue;">=&#8221;true&#8221;</span> <span style="color:red;">CodeBehind</span><span style="color:blue;">=&#8221;Default3.aspx.cs&#8221;</span> <span style="color:red;">Inherits</span><span style="color:blue;">=&#8221;VelocityTest.Default3&#8243;</span> <span style="background:#ffee62;">%&gt;</span></p>
<p style="margin:0;">
<p style="margin:0;"><span style="color:blue;">&lt;!</span><span style="color:#a31515;">DOCTYPE</span> <span style="color:red;">html</span> <span style="color:red;">PUBLIC</span> <span style="color:blue;">&#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</span> <span style="color:blue;">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;</span></p>
<p style="margin:0;">
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">html</span> <span style="color:red;">xmlns</span><span style="color:blue;">=&#8221;http://www.w3.org/1999/xhtml&#8221;</span> <span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">head</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">title</span><span style="color:blue;">&gt;</span>Velocity &#8211; Tag Example<span style="color:blue;">&lt;/</span><span style="color:#a31515;">title</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">head</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">body</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">form</span> <span style="color:red;">id</span><span style="color:blue;">=&#8221;form1&#8243;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">p</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">h3</span><span style="color:blue;">&gt;</span>Velocity &#8211; Tag Example<span style="color:blue;">&lt;/</span><span style="color:#a31515;">h3</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">table</span> <span style="color:red;">border</span><span style="color:blue;">=&#8221;0&#8243;</span> <span style="color:red;">cellpadding</span><span style="color:blue;">=&#8221;2&#8243;&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;</span>Cache Key<span style="color:blue;">&lt;/</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;txtCacheKey&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">RequiredFieldValidator</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;vadCacheKey&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">ControlToValidate</span><span style="color:blue;">=&#8221;txtCacheKey&#8221;</span> <span style="color:red;">ErrorMessage</span><span style="color:blue;">=&#8221;* required&#8221;</span> <span style="color:red;">Display</span><span style="color:blue;">=&#8221;Dynamic&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;</span>Cache Content<span style="color:blue;">&lt;/</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;txtCacheContent&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">RequiredFieldValidator</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;vadCacheContent&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">ControlToValidate</span><span style="color:blue;">=&#8221;txtCacheContent&#8221;</span> <span style="color:red;">ErrorMessage</span><span style="color:blue;">=&#8221;* required&#8221;</span> <span style="color:red;">Display</span><span style="color:blue;">=&#8221;Dynamic&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;</span>Cache Tags<span style="color:blue;">&lt;/</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;txtCacheTag&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span>(Tags are seperated by comma)<span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span><span style="color:red;">&amp;nbsp;</span><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Button</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;btnCancel&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;Cancel&#8221;</span> <span style="color:red;">CausesValidation</span><span style="color:blue;">=&#8221;false&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Button</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;btnSave&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;Save&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">table</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">p</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">hr</span> <span style="color:blue;">/&gt;</span></p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">p</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">table</span> <span style="color:red;">border</span><span style="color:blue;">=&#8221;0&#8243;</span> <span style="color:red;">cellpadding</span><span style="color:blue;">=&#8221;2&#8243;&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;</span>Search Method:<span style="color:blue;">&lt;/</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">RadioButtonList</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;radSearchMethodList&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">RepeatDirection</span><span style="color:blue;">=&#8221;Horizontal&#8221;&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">ListItem</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;No Tag&#8221;</span> <span style="color:red;">Value</span><span style="color:blue;">=&#8221;NoTag&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">ListItem</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;All Tags&#8221;</span> <span style="color:red;">Value</span><span style="color:blue;">=&#8221;AllTags&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">ListItem</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;Any Tag&#8221;</span> <span style="color:red;">Value</span><span style="color:blue;">=&#8221;AnyTag&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">ListItem</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;One Tag&#8221;</span> <span style="color:red;">Value</span><span style="color:blue;">=&#8221;OneTag&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">RadioButtonList</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;</span>Search Tags:<span style="color:blue;">&lt;/</span><span style="color:#a31515;">b</span><span style="color:blue;">&gt;&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TextBox</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;txtSearchTag&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span>(Tags are seperated by comma)<span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span><span style="color:red;">&amp;nbsp;</span><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Button</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;btnClearSearch&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;Clear&#8221;</span> <span style="color:red;">CausesValidation</span><span style="color:blue;">=&#8221;false&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Button</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;btnSearch&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:red;">Text</span><span style="color:blue;">=&#8221;Search&#8221;</span> <span style="color:red;">CausesValidation</span><span style="color:blue;">=&#8221;false&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">td</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">tr</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">table</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">p</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">hr</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:30px;margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">p</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">GridView</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;gvCache&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:red;">AutoGenerateColumns</span><span style="color:blue;">=&#8221;false&#8221;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:red;">EmptyDataText</span><span style="color:blue;">=&#8221;No cache data&#8221;&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">Columns</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TemplateField</span> <span style="color:red;">HeaderText</span><span style="color:blue;">=&#8221;Key&#8221;</span> <span style="color:red;">ShowHeader</span><span style="color:blue;">=&#8221;true&#8221;&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Label</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;lblCacheKey&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TemplateField</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TemplateField</span> <span style="color:red;">HeaderText</span><span style="color:blue;">=&#8221;Content&#8221;</span> <span style="color:red;">ShowHeader</span><span style="color:blue;">=&#8221;true&#8221;&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Label</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;lblCacheContent&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TemplateField</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TemplateField</span> <span style="color:red;">HeaderText</span><span style="color:blue;">=&#8221;Tags&#8221;</span> <span style="color:red;">ShowHeader</span><span style="color:blue;">=&#8221;true&#8221;&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">Label</span> <span style="color:red;">ID</span><span style="color:blue;">=&#8221;lblCacheTag&#8221;</span> <span style="color:red;">runat</span><span style="color:blue;">=&#8221;server&#8221;</span> <span style="color:blue;">/&gt;</span></p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">ItemTemplate</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">TemplateField</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">Columns</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">asp</span><span style="color:blue;">:</span><span style="color:#a31515;">GridView</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">p</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;">
<p style="margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">form</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">body</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">html</span><span style="color:blue;">&gt;</span></p>
</div>
<p>The third file is Default3.aspx.cs code-behind:</p>
<p><em><span style="font-style:normal;"><br />
</span></em></p>
<div style="font-family:Courier New;font-size:9pt;color:black;background:white;">
<p style="margin:0;"><span style="color:blue;">using</span> System;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Collections.Generic;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Linq;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Web;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Web.UI;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Web.UI.WebControls;</p>
<p style="margin:0;"><span style="color:blue;">using</span> System.Text;</p>
<p style="margin:0;"><span style="color:blue;">using</span> Microsoft.Data.Caching;</p>
<p style="margin:0;">
<p style="margin:0;"><span style="color:blue;">namespace</span> VelocityTest</p>
<p style="margin:0;">{</p>
<p style="padding-left:30px;margin:0;">[<span style="color:#2b91af;">Serializable</span>]</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">MyCacheItem</span></p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">string</span> Key { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">string</span> Content { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt; Tags { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> MyCacheItem(<span style="color:blue;">string</span> key, <span style="color:blue;">string</span> conent)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;">Key = key;</p>
<p style="padding-left:90px;margin:0;">Content = conent;</p>
<p style="padding-left:90px;margin:0;">Tags = <span style="color:blue;">new</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt;();</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> MyCacheItem(<span style="color:blue;">string</span> key, <span style="color:blue;">string</span> conent, <span style="color:blue;">string</span>[] tags)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;">Key = key;</p>
<p style="padding-left:90px;margin:0;">Content = conent;</p>
<p style="padding-left:90px;margin:0;">Tags = <span style="color:blue;">new</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt;();</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">foreach</span> (<span style="color:blue;">string</span> tag <span style="color:blue;">in</span> tags)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">Tags.Add(<span style="color:blue;">new</span> <span style="color:#2b91af;">DataCacheTag</span>(tag));</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">string</span>[] GetTags()</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">string</span>[] tags = <span style="color:blue;">null</span>;</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (Tags != <span style="color:blue;">null</span> &amp;&amp; Tags.Count &gt; 0)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">tags = <span style="color:blue;">new</span> <span style="color:blue;">string</span>[Tags.Count];</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">int</span> i = 0;</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">foreach</span> (<span style="color:#2b91af;">DataCacheTag</span> tag <span style="color:blue;">in</span> Tags)</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;">tags[i++] = tag.ToString();</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">return</span> tags;</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">}</p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">enum</span> <span style="color:#2b91af;">TagSearchMethod</span></p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;">NoTag,</p>
<p style="padding-left:60px;margin:0;">AllTags,</p>
<p style="padding-left:60px;margin:0;">AnyTag,</p>
<p style="padding-left:60px;margin:0;">OneTag</p>
<p style="padding-left:30px;margin:0;">}</p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">partial</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Default3</span> : System.Web.UI.<span style="color:#2b91af;">Page</span></p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">const</span> <span style="color:blue;">string</span> DEFAULT_DELIMITER = <span style="color:#a31515;">&#8220;,&#8221;</span>;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:#2b91af;">DataCacheFactory</span> _factory = <span style="color:#2b91af;">CacheWorker</span>.Instance.CacheFactory;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:#2b91af;">DataCache</span> _cache = <span style="color:#2b91af;">CacheWorker</span>.Instance.DefaultCache;</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> Page_Load(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;">btnSave.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnSave_Click);</p>
<p style="padding-left:90px;margin:0;">btnCancel.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnCancel_Click);</p>
<p style="padding-left:90px;margin:0;">btnClearSearch.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnClearSearch_Click);</p>
<p style="padding-left:90px;margin:0;">btnSearch.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnSearch_Click);</p>
<p style="padding-left:90px;margin:0;">gvCache.RowDataBound += <span style="color:blue;">new</span> <span style="color:#2b91af;">GridViewRowEventHandler</span>(gvCache_RowDataBound);</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;">gvCache.DataSource = GetCacheDataSource(<span style="color:#2b91af;">TagSearchMethod</span>.NoTag, <span style="color:blue;">null</span>);</p>
<p style="padding-left:90px;margin:0;">gvCache.DataBind();</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">MyCacheItem</span>&gt; GetCacheDataSource(<span style="color:#2b91af;">TagSearchMethod</span> method, <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt; tags)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">MyCacheItem</span>&gt; items = <span style="color:blue;">new</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">MyCacheItem</span>&gt;();</p>
<p style="padding-left:90px;margin:0;"><span style="color:#2b91af;">IEnumerable</span>&lt;<span style="color:#2b91af;">KeyValuePair</span>&lt;<span style="color:blue;">string</span>, <span style="color:#2b91af;">Object</span>&gt;&gt; cachePairs = <span style="color:blue;">null</span>;</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (method == <span style="color:#2b91af;">TagSearchMethod</span>.NoTag)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">cachePairs = _cache.GetObjectsInRegion(<span style="color:#2b91af;">CacheWorker</span>.DEFAULT_CACHE_REGION);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">else</span> <span style="color:blue;">if</span> (method == <span style="color:#2b91af;">TagSearchMethod</span>.AllTags)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">cachePairs = _cache.GetObjectsByAllTags(tags, <span style="color:#2b91af;">CacheWorker</span>.DEFAULT_CACHE_REGION);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">else</span> <span style="color:blue;">if</span> (method == <span style="color:#2b91af;">TagSearchMethod</span>.AnyTag)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">cachePairs = _cache.GetObjectsByAnyTag(tags, <span style="color:#2b91af;">CacheWorker</span>.DEFAULT_CACHE_REGION);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">else</span> <span style="color:blue;">if</span> (method == <span style="color:#2b91af;">TagSearchMethod</span>.OneTag)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">cachePairs = _cache.GetObjectsByTag(tags[0], <span style="color:#2b91af;">CacheWorker</span>.DEFAULT_CACHE_REGION);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (cachePairs != <span style="color:blue;">null</span>)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">foreach</span> (<span style="color:#2b91af;">KeyValuePair</span>&lt;<span style="color:blue;">string</span>, <span style="color:blue;">object</span>&gt; item <span style="color:blue;">in</span> cachePairs)</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;">items.Add((<span style="color:#2b91af;">MyCacheItem</span>)item.Value);</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;"><span style="color:blue;">return</span> items;</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> gvCache_RowDataBound(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">GridViewRowEventArgs</span> e)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (e.Row.RowType == <span style="color:#2b91af;">DataControlRowType</span>.DataRow)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;"><span style="color:#2b91af;">MyCacheItem</span> data = e.Row.DataItem <span style="color:blue;">as</span> <span style="color:#2b91af;">MyCacheItem</span>;</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">if</span> (data != <span style="color:blue;">null</span>)</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;"><span style="color:#2b91af;">Label</span> lblCacheKey = e.Row.FindControl(<span style="color:#a31515;">&#8220;lblCacheKey&#8221;</span>) <span style="color:blue;">as</span> <span style="color:#2b91af;">Label</span>;</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">if</span> (lblCacheKey != <span style="color:blue;">null</span>)</p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;">lblCacheKey.Text = data.Key;</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">
<p style="padding-left:150px;margin:0;"><span style="color:#2b91af;">Label</span> lblCacheContent = e.Row.FindControl(<span style="color:#a31515;">&#8220;lblCacheContent&#8221;</span>) <span style="color:blue;">as</span> <span style="color:#2b91af;">Label</span>;</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">if</span> (lblCacheContent != <span style="color:blue;">null</span>)</p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;">lblCacheContent.Text = data.Content;</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">
<p style="padding-left:150px;margin:0;"><span style="color:#2b91af;">Label</span> lblCacheTag = e.Row.FindControl(<span style="color:#a31515;">&#8220;lblCacheTag&#8221;</span>) <span style="color:blue;">as</span> <span style="color:#2b91af;">Label</span>;</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">if</span> (lblCacheTag != <span style="color:blue;">null</span>)</p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">if</span> (data.Tags != <span style="color:blue;">null</span>)</p>
<p style="padding-left:180px;margin:0;">{</p>
<p style="padding-left:210px;margin:0;">lblCacheTag.Text = <span style="color:#2b91af;">String</span>.Join(<span style="color:#a31515;">&#8220;,&#8221;</span>, data.GetTags());</p>
<p style="padding-left:180px;margin:0;">}</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">else</span></p>
<p style="padding-left:180px;margin:0;">{</p>
<p style="padding-left:210px;margin:0;">lblCacheTag.Text = <span style="color:#a31515;">&#8220;&amp;nbsp;&#8221;</span>;</p>
<p style="padding-left:180px;margin:0;">}</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> btnSearch_Click(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (radSearchMethodList.SelectedItem != <span style="color:blue;">null</span>)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;"><span style="color:#2b91af;">TagSearchMethod</span> method = (<span style="color:#2b91af;">TagSearchMethod</span>)<span style="color:#2b91af;">Enum</span>.Parse(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">TagSearchMethod</span>), radSearchMethodList.SelectedValue);</p>
<p style="padding-left:120px;margin:0;"><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt; tags = GetTags(txtSearchTag.Text.Trim());</p>
<p style="padding-left:120px;margin:0;">gvCache.DataSource = GetCacheDataSource(method, tags);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">else</span></p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">gvCache.DataSource = GetCacheDataSource(<span style="color:#2b91af;">TagSearchMethod</span>.NoTag, <span style="color:blue;">null</span>);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;">gvCache.DataBind();</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> btnClearSearch_Click(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;">Response.Redirect(Request.RawUrl);</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> btnCancel_Click(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;">Response.Redirect(Request.RawUrl);</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> btnSave_Click(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">if</span> (!<span style="color:#2b91af;">String</span>.IsNullOrEmpty(txtCacheKey.Text.Trim()) &amp;&amp;</p>
<p style="padding-left:90px;margin:0;">!<span style="color:#2b91af;">String</span>.IsNullOrEmpty(txtCacheContent.Text.Trim()))</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;"><span style="color:#2b91af;">MyCacheItem</span> item = <span style="color:blue;">null</span>;</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">string</span>[] tags = <span style="color:blue;">null</span>;</p>
<p style="padding-left:120px;margin:0;">
<p style="padding-left:120px;margin:0;"><span style="color:blue;">if</span> (!<span style="color:#2b91af;">String</span>.IsNullOrEmpty(txtCacheTag.Text.Trim()))</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;">tags = (<span style="color:blue;">string</span>[])txtCacheTag.Text.Trim().Split(DEFAULT_DELIMITER.ToCharArray());</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">
<p style="padding-left:120px;margin:0;"><span style="color:blue;">if</span> (tags != <span style="color:blue;">null</span> &amp;&amp; tags.Length &gt; 0)</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;">item = <span style="color:blue;">new</span> <span style="color:#2b91af;">MyCacheItem</span>(txtCacheKey.Text.Trim(), txtCacheContent.Text.Trim(), tags);</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">else</span></p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;">item = <span style="color:blue;">new</span> <span style="color:#2b91af;">MyCacheItem</span>(txtCacheKey.Text.Trim(), txtCacheContent.Text.Trim());</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">
<p style="padding-left:120px;margin:0;">_cache.Put(item.Key, item, item.Tags, <span style="color:#2b91af;">CacheWorker</span>.DEFAULT_CACHE_REGION);</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;">gvCache.DataSource = GetCacheDataSource(<span style="color:#2b91af;">TagSearchMethod</span>.NoTag, <span style="color:blue;">null</span>);</p>
<p style="padding-left:90px;margin:0;">gvCache.DataBind();</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">protected</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt; GetTags(<span style="color:blue;">string</span> tagString)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt; tags = <span style="color:blue;">new</span> <span style="color:#2b91af;">List</span>&lt;<span style="color:#2b91af;">DataCacheTag</span>&gt;();</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">string</span>[] items = tagString.Split(DEFAULT_DELIMITER.ToCharArray());</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;"><span style="color:blue;">foreach</span> (<span style="color:blue;">string</span> item <span style="color:blue;">in</span> items)</p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;">tags.Add(<span style="color:blue;">new</span> <span style="color:#2b91af;">DataCacheTag</span>(item));</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;"><span style="color:blue;">return</span> tags;</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">}</p>
<p style="margin:0;">}</p>
</div>
<p>The following are screenshots.</p>
<p>This screenshot has nothing is cache.</p>
<p><img class="alignnone size-full wp-image-128" title="ScreenShot001" src="http://atsung.files.wordpress.com/2009/06/screenshot001.jpg?w=479&#038;h=427" alt="ScreenShot001" width="479" height="427" /></p>
<p>This screenshot has 3 cache items.</p>
<p><img class="alignnone size-full wp-image-129" title="ScreenShot002" src="http://atsung.files.wordpress.com/2009/06/screenshot002.jpg?w=479&#038;h=427" alt="ScreenShot002" width="479" height="427" /></p>
<p>This screenshot is search by <strong>AllTags &lt;a&gt;</strong>.</p>
<p><img class="alignnone size-full wp-image-130" title="ScreenShot003" src="http://atsung.files.wordpress.com/2009/06/screenshot003.jpg?w=479&#038;h=427" alt="ScreenShot003" width="479" height="427" /></p>
<p>This screenshot is search by <strong>AllTags &lt;a, b&gt;</strong>.</p>
<p><img class="alignnone size-full wp-image-131" title="ScreenShot004" src="http://atsung.files.wordpress.com/2009/06/screenshot004.jpg?w=479&#038;h=427" alt="ScreenShot004" width="479" height="427" /></p>
<p>This screenshot is search by <strong>AnyTag &lt;a&gt;</strong>.</p>
<p><img class="alignnone size-full wp-image-132" title="ScreenShot005" src="http://atsung.files.wordpress.com/2009/06/screenshot005.jpg?w=479&#038;h=427" alt="ScreenShot005" width="479" height="427" /></p>
<p>This screenshot is search by <strong>AnyTag &lt;b&gt;</strong>.</p>
<p><img class="alignnone size-full wp-image-135" title="ScreenShot006" src="http://atsung.files.wordpress.com/2009/06/screenshot0062.jpg?w=479&#038;h=427" alt="ScreenShot006" width="479" height="427" /></p>
<p>This screenshot is search by <strong>Tag &lt;a, b&gt; &#8211; </strong><span style="color:#ff0000;">there are 4 cache items!</span></p>
<p><img class="alignnone size-full wp-image-136" title="ScreenShot007" src="http://atsung.files.wordpress.com/2009/06/screenshot007.jpg?w=479&#038;h=427" alt="ScreenShot007" width="479" height="427" /></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=126&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/06/01/velocity-ctp3-datacache-getobjectsbyanytag-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot001.jpg" medium="image">
			<media:title type="html">ScreenShot001</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot002.jpg" medium="image">
			<media:title type="html">ScreenShot002</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot003.jpg" medium="image">
			<media:title type="html">ScreenShot003</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot004.jpg" medium="image">
			<media:title type="html">ScreenShot004</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot005.jpg" medium="image">
			<media:title type="html">ScreenShot005</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot0062.jpg" medium="image">
			<media:title type="html">ScreenShot006</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/06/screenshot007.jpg" medium="image">
			<media:title type="html">ScreenShot007</media:title>
		</media:content>
	</item>
		<item>
		<title>Velocity (CTP3) &#8211; How do I know if a cache region is created?</title>
		<link>http://atsung.wordpress.com/2009/06/01/velocity-how-do-i-know-if-a-cache-region-is-created/</link>
		<comments>http://atsung.wordpress.com/2009/06/01/velocity-how-do-i-know-if-a-cache-region-is-created/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 00:51:08 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Distribued Cache]]></category>
		<category><![CDATA[Velocity]]></category>
		<category><![CDATA[Cache Region]]></category>
		<category><![CDATA[CTP3]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=118</guid>
		<description><![CDATA[In Velocity (CTP3) we can create, remove, and clean a cache region programmatically by calling the following methods:

DataCache.CreateRegion
DataCache.RemoveRegion
DataCache.ClearRegion

But there is no method to indicate if a cache region is created or not; so if I create a region which has been created already, an exception is thrown with the error code DataCacheErrorCode.RegionAlreadyExsits.
So far the walkaround [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=118&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In Velocity (CTP3) we can create, remove, and clean a cache region programmatically by calling the following methods:</p>
<ul>
<li>DataCache.CreateRegion</li>
<li>DataCache.RemoveRegion</li>
<li>DataCache.ClearRegion</li>
</ul>
<p>But there is no method to indicate if a cache region is created or not; so if I create a region which has been created already, an exception is thrown with the error code DataCacheErrorCode.RegionAlreadyExsits.</p>
<p>So far the walkaround is remove the cache region before creating it:</p>
<div style="font-family:Courier New;font-size:9pt;color:black;background:white;">
<p style="padding-left:30px;margin:0;">_defaultCache.RemoveRegion(DEFAULT_CACHE_REGION);</p>
<p style="padding-left:30px;margin:0;">_defaultCache.CreateRegion(DEFAULT_CACHE_REGION, <span style="color:blue;">true</span>);</p>
<p style="padding-left:30px;margin:0;">
</div>
<p>But this is not a good approach; so I hope the Velocity team will add the feature in the next release to check if a cache region is created.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/118/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/118/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/118/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=118&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/06/01/velocity-how-do-i-know-if-a-cache-region-is-created/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>
	</item>
		<item>
		<title>Use Velocity (CTP3) as Session State Provider</title>
		<link>http://atsung.wordpress.com/2009/05/22/use-velocity-ctp3-as-session-state-provider/</link>
		<comments>http://atsung.wordpress.com/2009/05/22/use-velocity-ctp3-as-session-state-provider/#comments</comments>
		<pubDate>Fri, 22 May 2009 03:32:03 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Distribued Cache]]></category>
		<category><![CDATA[Session]]></category>
		<category><![CDATA[Velocity]]></category>
		<category><![CDATA[CTP3]]></category>
		<category><![CDATA[Distributed Cache]]></category>
		<category><![CDATA[Session State Provider]]></category>
		<category><![CDATA[web.config]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=114</guid>
		<description><![CDATA[The blog shows how to configure web.config to use Velocity as session state provider, but it only works for CTP2.
I did some experiment and found out the following configuration in web.config will work in Velocity CTP3:

&#60;sessionState mode=&#8220;Custom&#8220; customProvider=&#8220;SessionStoreProvider&#8220;&#62;
 &#60;providers&#62;
 &#60;add name=&#8220;SessionStoreProvider&#8220; type=&#8220;Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary&#8220; /&#62;
 &#60;/providers&#62;
 &#60;/sessionState&#62;



       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=114&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The <a href="http://blogs.msdn.com/velocity/archive/2008/10/29/changes-to-session-state-provider-configuration-web-config-for-ctp2.aspx" target="_blank">blog</a> shows how to configure <span style="text-decoration:underline;">web.config</span> to use Velocity as session state provider, but it only works for <strong>CTP2</strong>.</p>
<p>I did some experiment and found out the following configuration in <span style="text-decoration:underline;">web.config</span> will work in Velocity <strong>CTP3</strong>:</p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">sessionState</span><span style="color:blue;"> </span><span style="color:red;">mode</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Custom</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">customProvider</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">SessionStoreProvider</span>&#8220;<span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">providers</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">add</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">SessionStoreProvider</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Microsoft.Data.Caching.DataCacheSessionStoreProvider, ClientLibrary</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">providers</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">sessionState</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"><br />
</span></p>
</div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=114&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/05/22/use-velocity-ctp3-as-session-state-provider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>
	</item>
		<item>
		<title>Notification callback in Velocity CTP3</title>
		<link>http://atsung.wordpress.com/2009/05/17/notification-callback-in-velocity-ctp3/</link>
		<comments>http://atsung.wordpress.com/2009/05/17/notification-callback-in-velocity-ctp3/#comments</comments>
		<pubDate>Sun, 17 May 2009 05:14:51 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Distribued Cache]]></category>
		<category><![CDATA[Velocity]]></category>
		<category><![CDATA[AddCacheLevelCallback]]></category>
		<category><![CDATA[Callback]]></category>
		<category><![CDATA[DataCacheOperation]]></category>
		<category><![CDATA[Distributed Cache]]></category>
		<category><![CDATA[Microsoft.Data.Caching]]></category>
		<category><![CDATA[Notification]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=98</guid>
		<description><![CDATA[This is an example of how to make the Notification callback work in Velocity CTP3.
Here is my web.config &#8211; the cache is a routing client:

&#60;?xml version=&#8220;1.0&#8220;?&#62;
&#60;configuration&#62;
 &#60;configSections&#62;

 &#60;!&#8211; required to read the &#60;dataCacheClient&#62; element &#8211;&#62;
 &#60;section name=&#8220;dataCacheClient&#8220;
 type=&#8220;Microsoft.Data.Caching.DataCacheClientSection,CacheBaseLibrary&#8220;
 allowLocation=&#8220;true&#8220;
 allowDefinition=&#8220;Everywhere&#8220;/&#62;

 &#60;!&#8211; required to read the &#60;fabric&#62; element, when present &#8211;&#62;
 &#60;section name=&#8220;fabric&#8220;
 type=&#8220;System.Data.Fabric.Common.ConfigFile,FabricCommon&#8220;
 allowLocation=&#8220;true&#8220;
 allowDefinition=&#8220;Everywhere&#8220;/&#62;


&#60;!&#8211; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=98&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This is an example of how to make the Notification callback work in <a href="http://msdn.microsoft.com/en-us/data/cc655792.aspx" target="_blank">Velocity CTP3</a>.</p>
<p>Here is my <span style="text-decoration:underline;">web.config</span> &#8211; the cache is a routing client:</p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;"><span style="color:blue;">&lt;?</span><span style="color:#a31515;">xml</span><span style="color:blue;"> </span><span style="color:red;">version</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">1.0</span>&#8220;<span style="color:blue;">?&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">configuration</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">configSections</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;!&#8211;</span><span style="color:green;"> required to read the &lt;dataCacheClient&gt; element </span><span style="color:blue;">&#8211;&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">section</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">dataCacheClient</span>&#8220;</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Microsoft.Data.Caching.DataCacheClientSection,CacheBaseLibrary</span>&#8220;</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> </span><span style="color:red;">allowLocation</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;</p>
<p style="padding-left:30px;margin:0;"><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></p>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;!&#8211;</span><span style="color:green;"> required to read the &lt;fabric&gt; element, when present </span><span style="color:blue;">&#8211;&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">section</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">fabric</span>&#8220;</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">System.Data.Fabric.Common.ConfigFile,FabricCommon</span>&#8220;</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> </span><span style="color:red;">allowLocation</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;</p>
<p style="padding-left:30px;margin:0;"><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></p>
<p style="margin:0;">
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;!&#8211;</span><span style="color:green;"> routing client</span><span style="color:blue;">&#8211;&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">dataCacheClient</span><span style="color:blue;"> </span><span style="color:red;">deployment</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">routing</span>&#8220;<span style="color:blue;">&gt;</span></p>
<p style="margin:0;">
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">clientNotification</span><span style="color:blue;"> </span><span style="color:red;">pollInterval</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">300</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
</div>
<p style="margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;!&#8211;</span><span style="color:green;"> cache host(s) </span><span style="color:blue;">&#8211;&gt;</span></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">hosts</span><span style="color:blue;">&gt;</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">host</span></p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">VIRTUALB-UJT42H</span>&#8220;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;"> </span><span style="color:red;">cachePort</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">22233</span>&#8220;</p>
<p style="padding-left:60px;margin:0;"><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></p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">hosts</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">dataCacheClient</span><span style="color:blue;">&gt;</span></p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">configuration</span><span style="color:blue;">&gt;</span></p>
</div>
</div>
</div>
<p>Here is the cache cluster configuration via the command <span style="text-decoration:underline;">Export-CacheClusterConfig</span>:</p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;"><span style="color:blue;">&lt;?</span><span style="color:#a31515;">xml</span><span style="color:blue;"> </span><span style="color:red;">version</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">1.0</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">encoding</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">utf-8</span>&#8220;<span style="color:blue;">?&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;</span><span style="color:#a31515;">configuration</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">configSections</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">section</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">dataCache</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Microsoft.Data.Caching.DataCacheSection, CacheBaseLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">configSections</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">dataCache</span><span style="color:blue;"> </span><span style="color:red;">cluster</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Velocity_Cluster_1</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">size</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Small</span>&#8220;<span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">caches</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">cache</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">partitioned</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">consistency</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">strong</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">default</span>&#8220;<span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">policy</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">eviction</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">lru</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">expiration</span><span style="color:blue;"> </span><span style="color:red;">defaultTTL</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">10</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">isExpirable</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">serverNotification</span><span style="color:blue;"> </span><span style="color:red;">isEnabled</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">policy</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">cache</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">cache</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">partitioned</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">consistency</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">strong</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">default_2</span>&#8220;<span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">policy</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">eviction</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">lru</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">expiration</span><span style="color:blue;"> </span><span style="color:red;">defaultTTL</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">10</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">isExpirable</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">serverNotification</span><span style="color:blue;"> </span><span style="color:red;">isEnabled</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">policy</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">cache</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">caches</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">hosts</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">host</span><span style="color:blue;"> </span><span style="color:red;">clusterPort</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">22234</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">hostId</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">1825498580</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">size</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">1024</span>&#8220;<span style="color:blue;"> </span><span style="color:red;">quorumHost</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">true</span>&#8220;</p>
<p style="margin:0;"><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">VIRTUALB-UJT42H</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;</p>
<p style="margin:0;"><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;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">hosts</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">advancedProperties</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;</span><span style="color:#a31515;">partitionStoreConnectionSettings</span><span style="color:blue;"> </span><span style="color:red;">providerName</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">System.Data.SqlClient</span>&#8220;</p>
<p style="margin:0;"><span style="color:blue;"> </span><span style="color:red;">connectionString</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">Data Source=VIRTUALB-UJT42H\SQLEXPRESS;Initial Catalog=Velocity_Shared_1;User Id=Not_sa;Password=ForYourEyesOnly;</span>&#8220;</p>
<p style="margin:0;"><span style="color:blue;"> </span><span style="color:red;">leadHostManagement</span><span style="color:blue;">=</span>&#8220;<span style="color:blue;">false</span>&#8220;<span style="color:blue;"> /&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">advancedProperties</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;"> &lt;/</span><span style="color:#a31515;">dataCache</span><span style="color:blue;">&gt;</span></p>
<p style="margin:0;"><span style="color:blue;">&lt;/</span><span style="color:#a31515;">configuration</span><span style="color:blue;">&gt;</span></p>
</div>
<p>Here is the code of <span style="text-decoration:underline;">CacheWorker.cs</span> (kind of helper class with singleton pattern):</p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;"><span style="color:blue;">using</span> System;</p>
<p style="margin:0;"><span style="color:blue;">using</span> Microsoft.Data.Caching;</p>
<p style="margin:0;">
<p style="margin:0;"><span style="color:blue;">namespace</span> VelocityTest</p>
<p style="margin:0;">{</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">CacheWorker</span></p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:blue;">object</span> _synclock = <span style="color:blue;">new</span> <span style="color:blue;">object</span>();</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">CacheWorker</span> _cacheWorker = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCacheFactory</span> _cacheFactory = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCache</span> _defaultCache = <span style="color:blue;">null</span>;</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">private</span> CacheWorker()</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">CacheWorker</span> Instance</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span></p>
<p style="padding-left:90px;margin:0;">{</p>
<p style="padding-left:120px;margin:0;"><span style="color:blue;">lock</span> (_synclock)</p>
<p style="padding-left:120px;margin:0;">{</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">try</span></p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">if</span> (_cacheWorker == <span style="color:blue;">null</span>)</p>
<p style="padding-left:180px;margin:0;">{</p>
<p style="padding-left:210px;margin:0;">_cacheWorker = <span style="color:blue;">new</span> <span style="color:#2b91af;">CacheWorker</span>();</p>
<p style="padding-left:210px;margin:0;">
<p style="padding-left:210px;margin:0;"><span style="color:green;">// we use configuration file</span></p>
<p style="padding-left:210px;margin:0;">_cacheFactory = <span style="color:blue;">new</span> <span style="color:#2b91af;">DataCacheFactory</span>();</p>
<p style="padding-left:210px;margin:0;">
<p style="padding-left:210px;margin:0;"><span style="color:green;">// default cache</span></p>
<p style="padding-left:210px;margin:0;">_defaultCache = _cacheFactory.GetDefaultCache();</p>
<p style="padding-left:180px;margin:0;">}</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">return</span> _cacheWorker;</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:150px;margin:0;"><span style="color:blue;">catch</span> (<span style="color:#2b91af;">DataCacheException</span> ex)</p>
<p style="padding-left:150px;margin:0;">{</p>
<p style="padding-left:180px;margin:0;"><span style="color:blue;">return</span> <span style="color:blue;">null</span>;</p>
<p style="padding-left:150px;margin:0;">}</p>
<p style="padding-left:120px;margin:0;">}</p>
<p style="padding-left:90px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">DataCacheFactory</span> CacheFactory</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span> { <span style="color:blue;">return</span> _cacheFactory; }</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;"><span style="color:blue;">public</span> <span style="color:#2b91af;">DataCache</span> DefaultCache</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:blue;">get</span> { <span style="color:blue;">return</span> _defaultCache; }</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">}</p>
<p style="margin:0;">}</p>
</div>
<p>Here is the partial code-behind of the test page:</p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">partial</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">_Default</span> : System.Web.UI.<span style="color:#2b91af;">Page</span></p>
<p style="margin:0;">{</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">const</span> <span style="color:blue;">string</span> CACHE_KEY = <span style="color:#a31515;">&#8220;{8768036E-2B99-4563-8BA5-C2D07B5B6023}&#8221;</span>;</p>
<p style="padding-left:30px;margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCacheFactory</span> _factory = <span style="color:#2b91af;">CacheWorker</span>.Instance.CacheFactory;</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">DataCache</span> _cache = <span style="color:#2b91af;">CacheWorker</span>.Instance.DefaultCache;</p>
<p style="padding-left:30px;margin:0;">
<p style="padding-left:30px;margin:0;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">protected</span> <span style="color:blue;">void</span> Page_Load(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e)</p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;"><span style="color:blue;">if</span> (!Page.IsPostBack)</p>
<p style="padding-left:60px;margin:0;">{</p>
<p style="padding-left:90px;margin:0;"><span style="color:#2b91af;">DataCacheOperation</span> filter = <span style="color:#2b91af;">DataCacheOperation</span>.AddItem | <span style="color:#2b91af;">DataCacheOperation</span>.RemoveItem | <span style="color:#2b91af;">DataCacheOperation</span>.ReplaceItem | <span style="color:#2b91af;">DataCacheOperation</span>.ClearRegion | <span style="color:#2b91af;">DataCacheOperation</span>.CreateRegion | <span style="color:#2b91af;">DataCacheOperation</span>.RemoveRegion;</p>
<p style="padding-left:90px;margin:0;"><span style="color:#2b91af;">DataCacheNotificationDescriptor</span> dn = _cache.AddCacheLevelCallback(filter, OnCacheNotificationReceived);</p>
<p style="padding-left:90px;margin:0;">
<p style="padding-left:90px;margin:0;">SetCache(MyPerson, <span style="color:blue;">true</span>);</p>
<p style="padding-left:90px;margin:0;">ShowCache(GetCache());</p>
<p style="padding-left:60px;margin:0;">}</p>
<p style="padding-left:60px;margin:0;">
<p style="padding-left:60px;margin:0;">btnUpdate.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnUpdate_Click);</p>
<p style="padding-left:60px;margin:0;">btnRefresh.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnRefresh_Click);</p>
<p style="padding-left:60px;margin:0;">btnRemove.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnRemove_Click);</p>
<p style="padding-left:60px;margin:0;">btnGet.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnGet_Click);</p>
<p style="padding-left:60px;margin:0;">btnAnotherPage.Click += <span style="color:blue;">new</span> <span style="color:#2b91af;">EventHandler</span>(btnAnotherPage_Click);</p>
<p style="padding-left:30px;margin:0;">}</p>
<p style="padding-left:30px;margin:0;">
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="padding-left:30px;margin:0;"><span style="color:green;">// other code is here&#8230;.</span></p>
<p style="margin:0;"><span style="color:green;"><br />
</span></p>
</div>
</div>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="padding-left:30px;margin:0;"><span style="color:blue;">public</span> <span style="color:blue;">void</span> OnCacheNotificationReceived(<span style="color:blue;">string</span> cacheName, <span style="color:blue;">string</span> regionName, <span style="color:blue;">string</span> key, <span style="color:#2b91af;">DataCacheItemVersion</span> version, <span style="color:#2b91af;">DataCacheOperation</span> cacheOperation, <span style="color:#2b91af;">DataCacheNotificationDescriptor</span> nd)</p>
<p style="padding-left:30px;margin:0;">{</p>
<p style="padding-left:60px;margin:0;"><span style="color:#2b91af;">StringBuilder</span> sb = <span style="color:blue;">new</span> <span style="color:#2b91af;">StringBuilder</span>();</p>
<p style="padding-left:60px;margin:0;">sb.Append(<span style="color:#a31515;">&#8220;cacheName: &#8220;</span> + cacheName + <span style="color:#2b91af;">Environment</span>.NewLine);</p>
<p style="padding-left:60px;margin:0;">sb.Append(<span style="color:#a31515;">&#8220;regionName: &#8220;</span> + regionName + <span style="color:#2b91af;">Environment</span>.NewLine);</p>
<p style="padding-left:60px;margin:0;">sb.Append(<span style="color:#a31515;">&#8220;key: &#8220;</span> + key + <span style="color:#2b91af;">Environment</span>.NewLine);</p>
<p style="padding-left:60px;margin:0;">sb.Append(<span style="color:#a31515;">&#8220;cacheOperation: &#8220;</span> + cacheOperation.ToString() + <span style="color:#2b91af;">Environment</span>.NewLine);</p>
<p style="padding-left:60px;margin:0;">txtMessageBox.Text = sb.ToString();</p>
<p style="padding-left:30px;margin:0;">}</p>
<div style="background:white none repeat scroll 0 0;font-family:Courier New;font-size:9pt;color:black;">
<p style="margin:0;">}</p>
</div>
</div>
<p>Basically the configuration has the Notification enabled and set the client as routing client. The callback is fired when ever there is a change in cache item or region.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/98/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/98/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/98/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=98&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/05/17/notification-callback-in-velocity-ctp3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>
	</item>
		<item>
		<title>Google Language ASP.NET Controls</title>
		<link>http://atsung.wordpress.com/2009/04/16/google-language-aspnet-controls/</link>
		<comments>http://atsung.wordpress.com/2009/04/16/google-language-aspnet-controls/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 04:42:11 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Google Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[CodePlex]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Server Control]]></category>
		<category><![CDATA[Translation]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=92</guid>
		<description><![CDATA[I published my second project at CodePlex &#8211; Google Language ASP.NET Controls.
In my previuos post, I wrote the sample code to create Google Ajax Language Custom Controls &#8211; they are Ajax-able, but this time I just build regular server control to save some time  
The usage is:

Include library:

&#60;%@ Register Assembly="GoogleLanguage.WebControls" Namespace="GoogleLanguage.WebControls" TagPrefix="glc" %&#62;

Bootstrap Javascript [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=92&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I published my second project at CodePlex &#8211; <a href="http://googlelanguage.codeplex.com/" target="_blank">Google Language ASP.NET Controls</a>.</p>
<p>In my <a href="http://atsung.wordpress.com/2008/08/26/google-ajax-language-custom-server-control/" target="_blank">previuos post</a>, I wrote the sample code to create <a href="http://atsung.wordpress.com/2008/08/26/google-ajax-language-custom-server-control/" target="_blank">Google Ajax Language Custom Controls</a> &#8211; they are Ajax-able, but this time I just build regular server control to save some time <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The usage is:</p>
<ul>
<li>Include library:</li>
</ul>
<pre>&lt;%@ Register Assembly="GoogleLanguage.WebControls" Namespace="GoogleLanguage.WebControls" TagPrefix="glc" %&gt;</pre>
<ul>
<li>Bootstrap Javascript with LanguageManager:</li>
</ul>
<pre>&lt;glc:LanguageManager ID="LanguageManager1" runat="server" /&gt;</pre>
<ul>
<li>Use &lt;Literal&gt; tag for next text:</li>
</ul>
<pre>&lt;glc:Literal ID="Literal5" runat="server" Text="Do you like music too?" DestinationLanguage="FRENCH" /&gt;</pre>
<ul>
<li>Use &lt;Translator&gt; tag for existing text in server controls:</li>
</ul>
<pre>&lt;asp:TextBox ID="TextBox1" runat="server" Text="Important Notice" /&gt;
&lt;glc:Translator ID="Translator2" runat="server" TargetControlID="TextBox1" DestinationLanguage="GERMAN" /&gt;</pre>
<p><strong>Screenshot &#8211; Sample Code</strong></p>
<pre>
<img class="alignnone size-full wp-image-93" title="Sample Code" src="http://atsung.files.wordpress.com/2009/04/google-language-aspnet-controls-sample-code.jpg?w=1024&#038;h=801" alt="Sample Code" width="1024" height="801" /></pre>
<p><strong>Screenshot &#8211; Sample Output</strong></p>
<pre>
<img class="alignnone size-full wp-image-94" title="Sample Output" src="http://atsung.files.wordpress.com/2009/04/google-language-aspnet-controls-sample-website.jpg?w=1024&#038;h=801" alt="Sample Output" width="1024" height="801" /></pre>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/92/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/92/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/92/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=92&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/04/16/google-language-aspnet-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/04/google-language-aspnet-controls-sample-code.jpg" medium="image">
			<media:title type="html">Sample Code</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/04/google-language-aspnet-controls-sample-website.jpg" medium="image">
			<media:title type="html">Sample Output</media:title>
		</media:content>
	</item>
		<item>
		<title>Expense Tracker</title>
		<link>http://atsung.wordpress.com/2009/04/14/expense-tracker/</link>
		<comments>http://atsung.wordpress.com/2009/04/14/expense-tracker/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 18:00:51 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Expense]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Tracker]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=88</guid>
		<description><![CDATA[I just publish my first windows application under Microsoft Public License (Ms-PL) &#8211; Expense Tracker &#8211; at CodePlex.com.
The idea of building Expense Tracker is I don&#8217;t want to use Excel spreed sheet to manage my expenses anymore. I have tried different personl finance programs but I found none of them fit my purpose &#8211; I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=88&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just publish my first windows application under Microsoft Public License (Ms-PL) &#8211; <a href="http://expensetracker.codeplex.com/" target="_blank">Expense Tracker</a> &#8211; at <a href="http://www.codeplex.com/" target="_blank">CodePlex.com</a>.</p>
<p>The idea of building <a href="http://expensetracker.codeplex.com/" target="_blank">Expense Tracker</a> is I don&#8217;t want to use Excel spreed sheet to manage my expenses anymore. I have tried different personl finance programs but I found none of them fit my purpose &#8211; I just need something can allow me to enter the amount, GST and PST on things I purchase (yes, I live in Canada, so tax matters). I even bought QuickBooks for bookkeeping, but it&#8217;s too complicated for me. Anyways, I have to build my own program to manage the expenses.</p>
<p><a href="http://expensetracker.codeplex.com/" target="_blank">Expense Tracker</a> uses SQLite as the database to store data in a file, so any SQLite client tool can open the file and manage the data manually if necessary. I used configuration file to store GST and PST rates based on user&#8217;s residential province, so user can change the settings based on his/her needs. So far I don&#8217;t any plan to make it working outside of Canada <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Here is the screen shot:</p>
<div id="attachment_89" class="wp-caption alignnone" style="width: 510px"><a href="http://expensetracker.codeplex.com/" target="_blank"><img class="size-full wp-image-89" title="Expense Tracker Screenshot" src="http://atsung.files.wordpress.com/2009/04/3440031697_811085d230.jpg?w=500&#038;h=411" alt="Expense Tracker Screenshot" width="500" height="411" /></a><p class="wp-caption-text">Expense Tracker Screenshot</p></div>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=88&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2009/04/14/expense-tracker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>

		<media:content url="http://atsung.files.wordpress.com/2009/04/3440031697_811085d230.jpg" medium="image">
			<media:title type="html">Expense Tracker Screenshot</media:title>
		</media:content>
	</item>
		<item>
		<title>DotNetNuke Reset Password</title>
		<link>http://atsung.wordpress.com/2008/11/18/dotnetnuke-reset-password/</link>
		<comments>http://atsung.wordpress.com/2008/11/18/dotnetnuke-reset-password/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 21:48:18 +0000</pubDate>
		<dc:creator>atsung</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DotNetNuke]]></category>
		<category><![CDATA[Change Password]]></category>
		<category><![CDATA[Generate Password]]></category>
		<category><![CDATA[Get Password]]></category>
		<category><![CDATA[Membership Provider]]></category>
		<category><![CDATA[Reset Password]]></category>

		<guid isPermaLink="false">http://atsung.wordpress.com/?p=80</guid>
		<description><![CDATA[When I use DotNetNuke.Entities.Users.UserController.ResetPassword(), I assume this method will set the password length to the length I defined in Membership Provider Settings, but which is not the case. So I have to manually create a new password with the minimum password length and change the current password.
Here is the code:

DotNetNuke.Entities.Users.UserInfo userInfo = DotNetNuke.Entities.Users.UserController.GetUserByName(PortalId, UserName);


DotNetNuke.Security.Membership.MembershipProvider membershipProvider [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=80&subd=atsung&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>When I use DotNetNuke.Entities.Users.UserController.ResetPassword(), I assume this method will set the password length to the length I defined in Membership Provider Settings, but which is not the case. So I have to manually create a new password with the minimum password length and change the current password.</p>
<p>Here is the code:</p>
<div style="font-family:Courier New;font-size:9pt;color:black;background:white;">
<p style="margin:0;">DotNetNuke.Entities.Users.<span style="color:#2b91af;">UserInfo</span> userInfo = DotNetNuke.Entities.Users.<span style="color:#2b91af;">UserController</span>.GetUserByName(PortalId, UserName);</p>
</div>
<div style="font-family:Courier New;font-size:9pt;color:black;background:white;">
<p style="margin:0;">DotNetNuke.Security.Membership.<span style="color:#2b91af;">MembershipProvider</span> membershipProvider = DotNetNuke.Security.Membership.<span style="color:#2b91af;">MembershipProvider</span>.Instance();</p>
<p style="margin:0;"><span style="color:blue;">if</span> (membershipProvider.PasswordFormat == DotNetNuke.Security.Membership.<span style="color:#2b91af;">PasswordFormat</span>.Encrypted)</p>
<p style="margin:0;">{</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">string</span> oldPassword = DotNetNuke.Entities.Users.<span style="color:#2b91af;">UserController</span>.GetPassword(<span style="color:blue;">ref</span> userInfo, userInfo.Membership.PasswordAnswer);</p>
<p style="padding-left:30px;margin:0;"><span style="color:blue;">string</span> newPassword = DotNetNuke.Entities.Users.<span style="color:#2b91af;">UserController</span>.GeneratePassword(membershipProvider.MinPasswordLength);</p>
<p style="padding-left:30px;margin:0;">DotNetNuke.Entities.Users.<span style="color:#2b91af;">UserController</span>.ChangePassword(userInfo, oldPassword, newPassword);</p>
<p style="margin:0;">}</p>
<p style="margin:0;"><span style="color:blue;">else</span></p>
<p style="margin:0;">{</p>
<p style="padding-left:30px;margin:0;">DotNetNuke.Entities.Users.<span style="color:#2b91af;">UserController</span>.ResetPassword(userInfo, userInfo.Membership.PasswordAnswer);</p>
<p style="margin:0;">}</p>
<p style="margin:0;">
<p style="font-family:Courier New;font-size:9pt;color:black;background:white;">
</div>
<p>The method GetPassword() will only return the password if the membership provider supports and is using a password encryption method that supports decryption.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/atsung.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/atsung.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/atsung.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/atsung.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/atsung.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/atsung.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/atsung.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/atsung.wordpress.com/80/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/atsung.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/atsung.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=atsung.wordpress.com&blog=4439908&post=80&subd=atsung&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://atsung.wordpress.com/2008/11/18/dotnetnuke-reset-password/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7ec703e693a5641f5e97b6387daeb887?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">atsung</media:title>
		</media:content>
	</item>
	</channel>
</rss>