State Management :: SQL Server Based Cache Dependency Without Data Source Control?
May 29, 2010I want to use SQL Server based Cache dependency without data source control.How can I do it?I am binding data to grid through code.
View 5 RepliesI want to use SQL Server based Cache dependency without data source control.How can I do it?I am binding data to grid through code.
View 5 RepliesI have a server control that I developed which generates navigation based on a third party CMS API. Currently I am caching this control using the PartialCaching attribute. The CMS uses cache key dependencies to invalidate the cache when a user makes an edit, however in the case of my server control it does not get invalidated and the updated navigation will not show up until the cache expiration set by the PartialCaching attribute.Here is my two part question:
What is the proper way to programmatically cache a server control, without using the PartialCaching attribute, and adding a cache key dependency?
Is it possible to continue to use the PartialCaching attribute and add a cache key dependency?
i have a usercontrol called navigationmenu whose data is static but varies with loged in1.empID 2.empType 3 Country my question is how can i cache the data of usercontrol based upon combination of these 3 parameters
View 9 Repliesi have 2 questions about output cache:1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :[URL]and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.
View 6 RepliesI have a senario where i want to add the data into cache but only 100 records should be added.
Is their any predefined functions available.
Basically i dont want to write if else condition whiile adding the records wether its 100 records present or not.
I have a webpage which displays some data along with a banner. The banner image is stored in the database with parameters "Pagename" and "form".
The application has been coded in such a way that when the page loads , a function checks for the banner in cache memory first with the parameters "pagename" and "form". It the banner does not exist, the new banner is retrieved from the database and is added to the cache memory. Next time when the same page is called, the banner is displayed from the cache memory avoiding the DB to be hit everything to get the banner.
Now, I do not want a specific banner to be displayed on the page. I have removed that banner from the DB but the banner still gets displayed as this banner is still there in the cache memory.
Is there any way to delete the banner which exists in cache memory without making any code changes?
it is having the grid with bulk of data. So i decided to move to Cache to strore the dataset. So that it avoids in gettin the data from DB for each time the page is loading. Suppose my idea isnot good please suggest me the best way to acheive this.My question is if i suppose store the data into the cache, how can i dispose or clear the cache from the memmory for each time i close my current page or application. I dont want the cache in memmory for long time, i want only upto the time the application is running.
View 6 RepliesIm working on my first ASPX webpage now, and Im wondering if there is some way to make a cache?
With a cache, I mean a list of variables that gets transferred from a db to for insance a hashtable the first time a user loads the page. When the next user loads the page, the db doesent get touched, but the variable is collected from the hashtable.
I tried to make a static class, but it re-loaded for each time I refreshed the page.
I'm running a website on a SQL 2008 database. At the moment most of my data is in cache but what I want to do is be able to update the data on a regular basis, say every 3 hours, maybe more frequently. Obviously I can set the cache to expire and pick up new data, but how can I replace part of the database (because some tables are populated by the user) in the background, so that when the cache expires the new data is picked up?
I notice when I upload data through VS, it wont let me upload if the DB is in use - so how do I get round issues like this?
Using the [Code].... for server cache Dependency, to get a list of the tables that are enabled, We use the line below:
[Code]....
i am trying to setup SqlCacheDependency with MS SQL Server 2008, i am using
aspnet_regsql.exe cmd line tool. I am able to enable it for database but when try to do it for table i get the following error message.Enabling the table for SQL cache dependency.
.An error has happened. Details of the exception: Login failed for user 'myUserName'.
Unable to connect to the SQL database for cache dependency registration.
i have done the following
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started [code]...
basically am using them to store user id and status, so that pages can be validated, by there use.i can stop person from accessing home directly wihtout signing is and so on.can session variable be hacked as they are stored in an external data source and are available to the full website?
I've got a web application that runs of a state server. It looks like soon it may need to distributed and there will be two web servers behind a load balancer.
This works great for session state but my next challenge is Cache
My application leverages heavily of cache. I understand ASP.Net 4.0 will be offering more here but nothing much has been said about the how too.
There are two challenges that I face
1). Each webserver will have its own copy of cache whereas it would be more efficient to put this to a third server the same as session state is put to state server.
2). The real challenge is keeping cache in sync if a simple dataset derived from the database is changed my code dumps that cache item and reloads the cache. That's all well on one webserver but webserver number two wont know to drop that particular cache item and reload it. This could cause some unexpected problems in the application.
For scenario number 2 I could attempt to do some smart coding so server number two knows to dump the cache and reload it.
My guess is someone else has already been here before and there's probably a better implementation approach rather than writing extra code.
Does anyone know how I could achieve the goal of keeping Cache in sync between multiple webservers or even better farm Cache management to another server?
I want to add a list to the cache and I would like it to stay there as long as posible.
Is there a way adding something to the cache permanently?
how do i set the exiry date of a cached object?
Is it possible to cache a hole site?ll its pages, images, js, db data etc...If so is it go/bad idea?
View 2 RepliesI have some weird problem. We're using Windows Server 2008 R2 x64 (8 Cores and
8 GB RAM) with IIS 7.5 and ASP.NET MVC 2.
I always cache (simple) stuff via the context cache and it seems like 9 out of 10 immediate page refreshs the Cache["MyKey"] is always null, even though there's no memory limit set on the pool and the server has lots of free memory.
I add expiring data via:
[Code]....
When just doing: Cache.Insert("MyKey", myObject); or Cache["MyKey"] = myObject; I get the same result (cache is almost always null for that key).
As you can see I added a callback, which writes the CacheItemRemovedReason to a text file, and the text file says CacheItemRemovedReason.Removed for MyKey. The doc for CacheItemRemovedReason.Removed says, that I call Remove/Insert on it, even though in my whole project there's no "Remove"-calls, just simple if(Cache["MyKey"] == null) {Cache["MyKey"] = ...} stuff.
I tried adding:
<caching><cache disableMemoryCollection = "true" disableExpiration = "true" privateBytesLimit="0" percentagePhysicalMemoryUsedLimit="90" privateBytesPollTime="00:02:00" /></caching>
to my web.config file in the System.Web-section but nothing changed :(
why Cache["MyKey"] is almost always null?
I have a treeview that shown groups and their sub groups in my usercontrol. I pass the parent GroupId to the usercpntrol from the page. I want to cache nodes of treeview for every Parent Group Id. My code is works good for first time and fill the cache object . after refresh the page, cache object fill the TreeNodeCollection succesfully and everything is ok. But after another refresh, cache object is not null but is empty and TreeNodeCollection.count is zero(0). What's my fault? Please help me to solve this problem.
[Code]....
I am looking for an elegant (i guess as elegant as it can be) solution to caching a users profile on login (whether it is session, cache, cookie, etc) and keeping it in sync when a users profile is changed. How do you guys handle this? Just simply call a Flush() method in your Save() method that invalidates the cache?
View 1 RepliesIs it possible to share a cache between multiple ASP.NET applications? The apps may reside on different servers. How can one achieve this requirement?
View 1 Replies I'm trying to cache a complex page with lots of controls on it so that if the user navigates to it later it will look like it did when he last saw it.The page has controls which post back and other controls are populated depending on the selections.
I'm using [Code]....
after the <@ Page directive.
What happens is that a postback gets the cached page, so no processing and it looks the same regardless of user selections. So far so good. But if I browse to another page and return by a link, the cached version is ignored and the default page is created again. This is more or less the opposite to what i want.
I attempted to use the validation callback to ensure that a postback resulted in a new version, and that worked, but it still ignored the cached page if it wasn't a postback.I realise that it will need more work to ensure each user gets their version of the page from the cache, but why bother if this doesn't work.
I know the big difference, but one thing is confusing me. Cache works only on a single machine on webfarm and to make it globally we use Velocity or memcache.So is static does same, or is it already work globally ?
eg
Cache["someid"] = "value"; //this will only work on single machine cache,
static string abc = "value"; // will this work on single machine or globally ?
Is it suitable to store some app settings in Application Cache? I mean settings that might need to be changed frequently...
View 1 Replies I have a page that has a grid view.
The user selects a person from a dropdown list and then clicks a button that adds the users info as
a new row in the grid.
Adding the new row involves doing an insert and rebinding the grid which is a slow process.
How do I use the cache to see the grid update right away?
I wanted to know the best practice for caching data. Say I have some control example a dropdown list which is populated from my db. Now this dropdown is global and used across many pages. I was thinking of not going to database everytime to fetch data for this dropdown and put the result in Cache. And then populate this dropdown from cache. Is this a good practice or if there is another approach. Can I store my datareader in cache and then use it globally. Also could I do this in application start event?
View 4 Repliesasp.net.2 I am trying to update the website but the cache kips on working. How can I relies the cache on site.
View 7 Replies