Enterprise Library Caching and Sql Dependencieshttp://forums.asp.net/t/1030228.aspx/1?Enterprise+Library+Caching+and+Sql+DependenciesWed, 03 Oct 2007 13:03:41 -040010302281412131http://forums.asp.net/p/1030228/1412131.aspx/1?Enterprise+Library+Caching+and+Sql+DependenciesEnterprise Library Caching and Sql Dependencies <p>ok so they didn't add the functionality for the sql dependencies and notifications into the enterprise library, so this is what i came up with so far as a wrapper:</p> <p>&nbsp;&nbsp;</p> <pre class="prettyprint">public class SqlExpiration : Microsoft.Practices.EnterpriseLibrary.Caching.ICacheItemExpiration, IDisposable { private SqlCacheDependency dp = null; private string database = string.Empty; private string table = string.Empty; public SqlExpiration(string database, string table) { this.table = table; this.database = database; dp = new SqlCacheDependency(database, table); } #region ICacheItemExpiration Members public bool HasExpired() { return dp.HasChanged; } public void Initialize(Microsoft.Practices.EnterpriseLibrary.Caching.CacheItem owningCacheItem) { } public void Notify() { } #endregion #region IDisposable Members public void Dispose() { if (dp != null) { dp.Dispose(); } } #endregion }</pre>&nbsp; <p>&nbsp;am i missing anything? it seems to work fine i just have no idea <br> </p> 2006-09-27T21:08:15-04:001583837http://forums.asp.net/p/1030228/1583837.aspx/1?Re+Enterprise+Library+Caching+and+Sql+DependenciesRe: Enterprise Library Caching and Sql Dependencies <p>Hi Harold.NET,</p> <p>&nbsp;&nbsp;&nbsp;&nbsp; very interesting indead!!! I like using the EntLibrary Caching service in my custom Data Access Layer instead of the&nbsp;web cache (which all the examples and people say to use)&nbsp;because i feel like it's tightly binding http web stuff to a reusable component (assembly) that might not be doing any web stuff. Pedantic, i know ... but it's the principle, for me at least.</p> <p>&nbsp;That said, i stumbled across this post and it has me VERY interested. I'm about to try this out ... but i was curious to see if you ended up using this in any projects? you said 'It seems to work fine' ... but can u elaborte on that - ie. The cache items get wiped/zapped when a database table gets updated -- proving that the sqlnotification broker stuff is working.</p> <p>also, did u setup your stuff using the asp_regsql.exe command?</p> <p>Please reply - very very intersted :)</p> <p>oh, ps. your two database and name fields are redundant - not required.</p> 2007-02-18T04:22:50-05:001584085http://forums.asp.net/p/1030228/1584085.aspx/1?Re+Enterprise+Library+Caching+and+Sql+DependenciesRe: Enterprise Library Caching and Sql Dependencies <p>Yes, I used the reqsql command and all.</p> <p>&nbsp;</p> <p>It is working great for my projects, I see no issues at all with anything. &nbsp;</p> 2007-02-18T14:27:30-05:001584517http://forums.asp.net/p/1030228/1584517.aspx/1?Re+Enterprise+Library+Caching+and+Sql+DependenciesRe: Enterprise Library Caching and Sql Dependencies <p>Hi Harrold.</p> <p>1) Why did u use the aspnet_regsql.exe command? what functionality does it do, which you are required to use?</p> <p>2) Why did u go with using the EntLibrary's Caching component instead of using the http caching stuff which most people suggest using? The reason i ask this is because&nbsp;I don't want to use the Asp caching object thing because i'm doing my caching in a Data Access Layer and it seems silly to put web stuff in there when the reusable assembly might not be doing any web stuff at all (eg a winform app) .. even though the System.Web... namespace stuff works fine in a winform ... and the SqlCacheDependency class is found in System.Web.... or something.<br> </p> 2007-02-19T03:07:18-05:001938605http://forums.asp.net/p/1030228/1938605.aspx/1?Re+Enterprise+Library+Caching+and+Sql+DependenciesRe: Enterprise Library Caching and Sql Dependencies <p>Harold,</p> <p>Have you used this in a farm/clustered environment?&nbsp; We ran across a problem with caching in sql server for a couple reasons.&nbsp; 1) I wasn't specifying an expiration so the artifacts remained in cache indefinitely and 2) when a server in the cluster reset, caching would blow chunks until a manual delete was issued for the tables that stored the cached artifacts.</p> <p>-T</p> 2007-10-03T13:03:41-04:00