473,626 Members | 3,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How and when should I use CacheItemPriori ty.NotRemovable ?

Hi,
I wrote the code to test how CacheItemPriori ty.NotRemovable works:

Cache.Insert("T ime", DateTime.Now,
new System.Web.Cach ing.CacheDepend ency(Server.Map Path("Test.txt" )),
System.Web.Cach ing.Cache.NoAbs oluteExpiration ,
System.Web.Cach ing.Cache.NoSli dingExpiration,
CacheItemPriori ty.NotRemovable , null);

When then Test.txt is changed, the cache item "Time" is unavailable,
so CacheItemPriori ty.NotRemovable parameter is useless here?
How to use CacheItemPriori ty.NotRemovable and when should I use it?

Thanks!
Nov 26 '05 #1
2 5425
I would advise against using it. Your basically telling .NET to do
everything it can to keep the item in the cache. Of course, if the file
changes, that'll take priority. The priority only takes effect when none of
your other conditions are met (dependency, expiration time) but .NET needs
to free up some memory. It'll go through all the Cache item and purge them
based on priority until the needed amount of data is freed.

If you really don't want something to be removed, store it in the
Application object. But I'd only do that, or use NotRemovable when it was a
small piece of data that took a very very long time to get.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Michael" <hu**********@g mail.com> wrote in message
news:Oj******** *****@TK2MSFTNG P15.phx.gbl...
Hi,
I wrote the code to test how CacheItemPriori ty.NotRemovable works:

Cache.Insert("T ime", DateTime.Now,
new System.Web.Cach ing.CacheDepend ency(Server.Map Path("Test.txt" )),
System.Web.Cach ing.Cache.NoAbs oluteExpiration ,
System.Web.Cach ing.Cache.NoSli dingExpiration,
CacheItemPriori ty.NotRemovable , null);

When then Test.txt is changed, the cache item "Time" is unavailable,
so CacheItemPriori ty.NotRemovable parameter is useless here?
How to use CacheItemPriori ty.NotRemovable and when should I use it?

Thanks!

Nov 26 '05 #2
Hi Karl,

Got it! Thank you very much :)
I would advise against using it. Your basically telling .NET to do
everything it can to keep the item in the cache. Of course, if the file
changes, that'll take priority. The priority only takes effect when none
of your other conditions are met (dependency, expiration time) but .NET
needs to free up some memory. It'll go through all the Cache item and
purge them based on priority until the needed amount of data is freed.

Nov 26 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
19951
by: sql-db2-dba | last post by:
Does DB2 just fudge it when it is an empty table? Is there a "formula" for average row size when you have variable length records. Or you really have to know what your application is packing into those varchar columns. Bill Leung leungb@aptea.com
4
5923
by: Peter Row | last post by:
Hi, I have created a UserControl which is subsequently hosted on a standard form. My control has a TabControl on it but it has no TabPages configured. At runtime I create X pages and put a single RichTextBox on each page. In my controls loaded event I call my Render() method which configures everything appropriately. When setting up the TabControl the first thing it says is (not real var names):
5
555
by: AAguiar | last post by:
I have an asp.net project where the code behind the aspx page calls a c# class which makes calls to a managed static C++ class. The C# class works fine when the asp net worker process starts, when it is invoked by pressing "F5", or when the web.config file is modified. In all these cases the web.config file contains <identity impersonate="false" />. The mysterious problem arrises when I set <identity impersonate="true"/> in the...
8
2563
by: Galina | last post by:
Hello I have 6 dependent list boxes on my ASP page:  Faculty;  Lecturer;  Course;  Course occurrence;  Group;  Week commencing date. When faculty is selected, lists of lecturers and courses are populated. When course is selected, lists of occurrences, groups and
3
3075
by: Hitesh | last post by:
Hi, I am getting the response from another Website by using the HttpHandler in my current site. I am getting the page but all the images on that page are not appearing only placeholder are displayed. Can anybody know this issue and help me to resolve this. In past i received the response saying that i should download the image first and then parse the actual response and modify the src attribute of the
6
1760
by: Adam | last post by:
On an xp machine, the caching works as expected. I have deployed to a win2k server, and an item I add to the cache expires almost immediately some times and in under a minute in other times. The aspnet_wp process is not restarting during this time, and there are no other requests, so nothing should be clearing this out. I have added a CacheItemRemovedCallback which writes debug info out to a DefaultTraceListener, but no output shows up on...
2
2415
by: mahesh.prasad | last post by:
Hi, I'm trying to add an object to the .NET cache using a CacheDependency and I get the following exception : System.InvalidOperationException: Cache_dependency_used_more_that_once at System.Web.Caching.CacheEntry.MonitorDependencyChanges() at System.Web.Caching.CacheSingle.UpdateCache(CacheKey cacheKey, CacheEntry newEntry, Boolean replace, CacheItemRemovedReason removedReason, Object& valueOld)
3
5415
by: mrutyunjaya | last post by:
if (Cache==null) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings.ConnectionString); SqlDataAdapter mydataadapter = new SqlDataAdapter("select intproductid,vchproductname,vchproductacctype,vchprodacclogoimg from productmaster order by intproductid desc", con); mydataadapter.Fill(ds, "Authors");
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7192
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6122
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.