Add Or Update Or Delete Cached Data - Remove The Entire List From The Cache

Jan 17, 2010

U are caching a list of items, then Add or update or delete method called. Approach 1)

A- Do the data change at the database. If success do B, C
B- Remove the entire list from the Cache.
C- Re-Cache the list on first read.

Approach 2)

A- Do the data change at the database, If success do B
B- Do the same change at the cached items, and save more time.

Approach(2) probably will cause nasty difficult to spot bugs, because the data come from BLL and placed directly into cache, One can't assume no bugs will happen at the sproc, I am not worry about database runtime errors, runtime errors will show up, but I am worry about invalid data, or miss calculation. Can I proceed with approach (2) with caution? Is there a "best practice" principle which suggest not doing approach(2)?

View 2 Replies


Similar Messages:

C# - HttpRuntime.Cache.Remove Doesn't Remove Cache

Nov 19, 2010

I am trying to remove the cache using the HttpRuntime.Cache.Remove(key) but invain. I wonder what are the best practices for using HttpRuntime.Cache.

View 2 Replies

Forms Data Controls :: Delete And Update Implementations For A Generic List?

Nov 30, 2010

I have a following generic list method that contains some data for a gridview. I need to supply edit and delete functionality for it.


List<students> List(string id)
{
List<students> st = new List<students>();

[code]...

View 4 Replies

Modify An Object From Cache And It Changes The Cached Value

May 8, 2010

I'm having an issue when using the Asp.Net Cache functionality. I add an object to the Cache then at another time I get that object from the Cache, modify one of it's properties then save the changes to the database.

But, the next time I get the object from Cache it contains the changed values. So, when I modify the object it modifies the version which is contained in cache even though I haven't updated it in the Cache specifically. Does anyone know how I can get an object from the Cache which doesn't reference the cached version?i.e.

Step 1:
Item item = new Item();
item.Title = "Test";
Cache.Insert("Test", item, null, DateTime.Now.AddHours(1), System.Web.Caching.Cache.NoSlidingExpiration);

Step 2:
Item item = (Item)Cache.Get("test");
item.Title = "Test 1";

Step 3:
Item item = (Item)Cache.Get("test");
if(item.Title == "Test 1"){
Response.Write("Object has been changed in the Cache.");
}

I realise that with the above example it would make sense that any changes to the item get reflected in cache but my situation is a bit more complicated and I definitely don't want this to happen.

View 2 Replies

C# - How To Invalidate Cache When The File Which Is Cached Changes

Dec 17, 2010

I read few xml files from a location and cache them using Http context cache. Anytime the xml files changes i have to do a IISReset to view the latest changes.

I use this

System.Web.HttpContext.Current.Cache

I have to use the caching as i don't want to read all the xml files all the time. i read it once and caches them for a day. They get reset whenever apppool recyles or anyone manualy do a IISReset.

Is there anyway in asp.net to invalidate the cache if someones changes the xml file.

View 1 Replies

Web Forms :: Clear Browser Cache And Stop Pages From Being Cached?

Oct 25, 2013

when i first run my applcation some time its showing the data from cache.i want to avoid it in first time .

i want to cache my all images/css/js file what is the efficient way to do it.

i have lot of images folder /js /css files.

View 1 Replies

MVC :: Remove ALL Output Cached Pages?

Jan 20, 2011

How do I remove all of the pages I have placed in the output cache? I know you can use
HttpResponse.RemoveOutputCacheItem to remove a single page but how do I "clear" it, i.e. removing ALL pages?

View 5 Replies

Web Forms :: Update Cached Data If There Is Any Change In Database

Jun 29, 2012

I want to update my cached data , if there is any change in database. , if any change in database/tables happens then my cached data should be updated.

View 1 Replies

How To Update / Delete The Table Records In ASPNETDB.MDF In Single Update / Delete Query

Nov 29, 2010

I want to know how to Update / delete the table records in ASPNETDB.MDF in single update / delete query ?

View 1 Replies

Architecture :: Cache The Full List Of Objects In Http Cache On The Service Tier And Page In Memory?

Feb 25, 2011

We have a wfc layer that wraps the business classes and database access and use a client that lives on the database layer. Amongst our group we are attempting to form standards. Some want to have the client call the web method and pass the page they are requesting and the page size. Pass that to the database and then page in SQL Server use RowNum.Some want to cache the full list of objects in http cache on the service tier and page in memory. They concern here is memory use on the server.

Which would be best for a medium number of users with potentially large number of records to manage (say 30K) Is it better to cache them all in memory and work from there or page at the database as the application scales?

View 1 Replies

Forms Data Controls :: Add / Remove And Delete A Node In A Treeview?

Jan 17, 2011

I want to add, edit(update) and delete a node from a treeview. These all opeartion must be performed on the treeview itself.

I am using VS2010 with framework 3.5, in asp.net c# language.

My database is Mysql.

View 1 Replies

Cache A List Of Data C#?

Feb 27, 2011

I want to implement caching of a list pulled from the db. I've had a look at this:

How can I cache objects in ASP.NET MVC?

I have this in my code:

var addresses = repository.GetAllAddresses();//returns IQueryable<string>

using the answer in the question above how can i cache this?, I have created the class CacheExtensions, but not sure where to go from there.

View 1 Replies

Forms Data Controls :: Remove Delete Button From Gridview Column?

Mar 24, 2010

i am working with a gridview and created it in following way:

[Code]....

Now i want to remove the Select, Edit and Delete link buttons in the last columns for a particular row. It should remain as it is for other rows. Only linkbutton from a particular row(being determined from data key) is to be removed.

View 12 Replies

Tsql - .Net MVC Best Way To Update Cached Table

Apr 19, 2010

There are certain tables that get called often but updated rarely. One of these tables is Departments. So to save DB trips, I think it is ok to cache this table taking into consideration that the table has very small size. However, once you cached it an issue of keeping the table data fresh occurs. So what is the best way to determine that the table is dirty and therefore requires a reload and how that code should be invoked. I look for solution that will be scalable. So updating the cache on single right after inserting will not resolve the issue. If one machine inserted the record all other on the farm should get notified to reload the cache.

View 3 Replies

Web Forms :: Reflect Recently Changed Image File And Remove Cached Image From Browser?

Jul 10, 2013

<asp:Image ID="aspImagePreview" runat="server" AlternateText="Preview" Height="190px" Width="290px" ImageUrl="~/file1.jpg" />

when the file file1 has been changed or removed. How can I do one refresh to the item to make it reflect the recent change?

View 1 Replies

Add/Remove Cache As Filter On Controller?

Dec 7, 2010

I am looking for a Cache filter which can be removed when certain action is performed.

Suppose,I have Index action which is loading records and cached with a filter for a minute.As long as I am calling Index the action must be cached and no trip to db.

Once I create a record in Create action than it should remove the cache a load the records from DB.I have found one in Ninject web example which is like below. I am looking for same solution.

[Cache(0, 0, 5, 0)]
public ActionResult Index()
{ [code]...

View 1 Replies

.net - Remove A Cache Entry Which Didn't Put There?

Sep 12, 2010

Precondition: There's a web application that leverages ASP.NET security model. There's also an Active Directory (AD) integration component. It provides AD users and roles as if those are application's own users and roles. The relations like "is in role" between AD user and AD role are stored in AD domain, of course, but are cached by the web application.

Problem: Let's say AD user1 is a member of AD role1. When web application starts, it caches this relation. Now if the AD administrator removes user1 from role1 using AD console, the application doesn't know about this change - the cache entry is kept. This becomes a security hole because the role1 might have permissions the user1 should no longer have.

There are two сcontrary opinions how to solve this:

"Listen" to AD changes and trigger cache entry removal once the operation is detected on AD server - because we are responsible for correct AD component functioning Leave the cache untouched - because we didn't put the entry there and should not remove it either

View 1 Replies

C# - Cached Objects Update Automatically With The Object Updating?

Jul 2, 2010

I found some code on the web and it threw me off. Look at the code below. You will notice only when the Hits == 1, does the cache get added. After that, the cache object isn't updated. It begs the question, does the object when updated, update the cache as well automatically? The answer here would make me remove some code in some of my classes.

public static bool IsValid( ActionTypeEnum actionType )
{
HttpContext context = HttpContext.Current;
if( context.Request.Browser.Crawler ) return false;
string key = actionType.ToString() + context.Request.UserHostAddress;
var hit = (HitInfo)(context.Cache[key] ?? new HitInfo());
if( hit.Hits > (int)actionType ) return false;
else hit.Hits ++;
if( hit.Hits == 1 )
context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(DURATION),
System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, null);
return true;
}

I would only guess that I would need to add the lines after the if statement:

if( hit.Hits == 1 )
context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(10),
System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, null);
else if (hit.Hits > 1)
{context.Cache.Remove(key);
context.Cache.Add(key, hit, null, DateTime.Now.AddMinutes(10),
System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, null);
}
Found the code at the bottom of the page here: http://www.codeproject.com/KB/aspnet/10ASPNetPerformance.aspx?msg=2809164

View 1 Replies

How To Get The List Of Users And Also To Update/Delete Users

Aug 11, 2010

I have used Login Control + Change Password + Create User Wizard in my project. Everything is working fine. I want to know that how to get the List of Users and also to Update/Delete users.

View 1 Replies

Unable To Remove Browser Cache Image?

Jan 22, 2011

i am using Jcrop to give users the option to crop there images, i have hit a small caching problem.

if you open an image which is already on the server and crop it. my jcrop works and crops the image fine but when i reload the image the old version is displayed. i have this inside an update panel.

so is there a way of removing the browsers cache before i reload the image?

View 5 Replies

State Management :: Remove Cache When OutOfMemory?

Dec 9, 2010

I am Caching dataset in my application, the issue is when there is a large set of data the OutOfMemory exception is thrown.

I want to check for the this exception and when it happens I want to remove the cache object.

View 4 Replies

Web Forms :: How To Remove Css / JavaScript File From Browser Cache For IE6 And IE7

Jun 28, 2010

how to remove css,java script file from browser cache for IE6 and IE7 ?

View 4 Replies

Security :: Remove The Cache Of A Page After The User Signs Out

Jan 21, 2011

I have an ASP.NET website in which the user has the Login/Logout functionality. There are some pages which are viewable only if the user is logged in. Now, after the user signs out, I noticed that the user is still able to see this restricted page on pressing the back button. I want to create the functionality such that once the user signs out, the page should not be viewable. How can that be done?

P.S I am not using built in Login controls in ASP.NET

View 2 Replies

Delete Cache When Web Browser Is Closed?

Oct 13, 2010

I have issue about multiple login in asp.net.

Case this happen:

User X login as "user1" in web browser.
Then user Y also login as "user1" also in another web browser.
User Y got error message "Another user log in some account".

That is work as expected.

If X, close their web browser. Then try again to login in as "user1".
X get also get "Another user log in some account".

So i trying debug then i found session is remove when web browser is close, but cache still remaining in web browser.

how to clear cache when user close their browser, (not tab).

View 1 Replies

Delete Cache In Website On Same Server?

Jul 21, 2010

I have two separate websites on the same server. One site is a forum (written in ASP Classic) where users may post information in various sections and threads etc. The other website (written in ASP.NET VB) is used for a club where users may purchase and download videos, etc. The Forum site uses caching to retain member information on each registered user. The club website has do do updates to a few of the user data fields stored on the Forum database. The problem is that I need to delete the cached information saved to cache for a specific user whenever I update the users information from the club website. Updates done on the Forum work just fine because it does delete the cache.

I have tried to access the cache from the ASP.NET club website using: Application.Contents("_mbUI-2") Which is the proper key but I get "Nothing". Since I can't access it, I can't delete it either. I guess the "Application" is separate due to the separate websites.

If I could call a page on the ASP site using xmlhttp, I could write a program to delete the cache. But, I need to call it from the code-behind, not by an event such as pressing a button and using javascript to make the http call.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved