iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
I have defined ISDataSource table with CacheKeyDependency attachement1.png
On page load I created cache
Cache.Insert("CacheKey",DateTime.Now);
ISDataSource. CacheKeyDependency is set to "CacheKey"
After changing cache under "CacheKey", ISDataSource cache should be invalidated, but it didn't happen.
I've noticed that cache collection contain 3 positions connected with this case
Key=CacheKey, Value=02-09-2009 17:05:23
Key=uCacheKey:PODMIOT:3600:Sliding:Hahs2TableAdapters.PODMIOTTableAdapter:GetData, Value=2
Key=uCacheKey:PODMIOT:3600:Sliding:Hahs2TableAdapters.PODMIOTTableAdapter:GetData:0:0, Value=PODMIOT
This works fine if I use sqlDataSource or ObjectDataSource instead of ISDataSource.
Please, Could you send me some example how to use ISDataSource CacheKeyDependency in this case.
Good news! Our development team has enhanced the CacheKeyDependency feature to work consistently with the behavior found in .NET's ObjectDataSource and SqlDataSource.
The enhancement will be available in the next build coming later this month. Please note that the enhancement will require update on both Framework and ISDataSource assembly, which will be posted together in the monthly hotfix release.
ISDataSource has provided a function to clear the table cache, using the ClearCache function of the ISDataSource table. We could demonstrate this function by modifying the UsingCacheKeyDependency.aspx ISdataSource sample. Please add an ASP.NET button with a click event handler:
protected void Button1_Click(object sender, EventArgs e){ ISDataSource1.Tables.GetNamedItem("TimedDataKeyDependency").ClearCache(); GridView1.DataBind();}
A button click will refetch the data because the cache has already been cleared
Glenn,
Thank you for you answer, but it isn't so simple. I presented simplest case in my solution. My real scenerio must have posibility to invalidate some cache from different page. Clearing cache suggested by you works only if I am on this page now and ISDataSource1 exists. I am trying to use CacheKeyDependency as it was designed by Microsoft. MSDN cachekeydependency
In ma scenario
I create cache in global.ascx
then I configure cache for table on Page1.aspx attachement1.png. ISDataSource1 CacheKeyDependency is set to "CacheKey"
After that I'm going to Page2.aspx and changing cache under "CacheKey"
Cache.Insert("CacheKey",DateTime.Now); <- Here we have new date than previous one.
Table cache on Page1.aspx should invalidate by itself on first load this page.
Regards,
Mariusz
ISDataSource will generate multiple key in the Cache object for its internal mechanism, just as you reported before. In order to invalidate the data you will need to clear all the keys generated by the ISDataSource in the Cache object.
The idea is to iterate all the Cache object key and delete the key that match the pattern of the key created by the ISDataSource. In the snippet the CacheKeyDependency is "key1"
protected void Button1_Click(object sender, EventArgs e){ IDictionaryEnumerator CacheEnum = Cache.GetEnumerator(); ArrayList keyList = new ArrayList(); while(CacheEnum.MoveNext()) { if (CacheEnum.Key.ToString().Contains("key1:") || CacheEnum.Key.ToString() == "key1") { keyList.Add(CacheEnum.Key); } } foreach (string key in keyList) { Cache.Remove(key); } GridView1.DataBind();}
Thanks again.
Your first and second solution works fine.
I know that there is cache collection like I mentioned in my first post . I considered to use your second solution to go through entire cache collection and find this cache keys that containt specific key (e.g. "CacheKey"). But this is some kind prosthesis. I am still waiting for answer about CacheKeyDependency or could you please admit that "CacheKeyDependency" doesn't work properly and I should find diffrent way to solve my problem. My next question to someone from support team is "Will it be fixed?".
Hi Mariusz,
Thank you for posting such interesting discussion!
It appears that we implement CacheKeyDependency differently than that in ObjectDataSource. However, after more investigation based on your feedback, our development team will investigate the possibility to enhance the feature to provide more consistent behavior as expected in datasource control.
I'll keep you updated on this thread when the enhancement becomes available.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname