Cache Class - Differences Between .NET 3.5 And .NET 4.0?
Jun 9, 2010Are there any major differences between the ASP.NET Cache Class from ASP.NET 3.5 to 4.0?
View 2 RepliesAre there any major differences between the ASP.NET Cache Class from ASP.NET 3.5 to 4.0?
View 2 RepliesI have a class instance which is created by using Activator.CreateInstance() method. That class instance contains helper methods which are frequently used throughout the application. In order to avoid creating the instance multiple times, I'm just thinking about implementing an appropriate caching mechanism. The following consideration should be taken into account:
1) I can't use static class and methods.
2) There are around 6 instances (1 instance per class) per App Domain.
Is that possible to get access to Session, Cache, Server.MapPath() from a class in App_code?
View 1 RepliesIs it correct to implement my caching object like this in my controller :
[code]....
And I Use it like this :
[code]....
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?
What are the "optimal" parameters for creating an AppFabric cache when you will be storing session state in the cache? MSDN Cache-Related Commands
Powershell command line:
New-Cache [-CacheName] <String> [-Eviction <String>] [-Expirable <String>] [-Force [<SwitchParameter>]] [-NotificationsEnabled <String>] [-Secondaries <Int32>] [-TimeToLive <Int64>]
[code]...
Since I don't want my sessions to be removed unless the session has been abandoned either via code or Session Timeout...For eviction, I would think "None" and for expireable, I would think False.I have tested and calling Session.Abandon does remove the object from the cache. I have also tested to see if by extending my session, the session object in cache is also extended. This does seem to work the "correct" way.
We have a data driven ASP.NET website which has been written using the standard pattern for data caching (adapted here from MSDN):
public DataTable GetData()
{
string key = "DataTable";
object item = Cache[key] as DataTable;
[code]...
The trouble with this is that the call to GetDataFromSQL() is expensive and the use of the site is fairly high. So every five minutes, when the cache drops, the site becomes very 'sticky' while a lot of requests are waiting for the new data to be retrieved.
What we really want to happen is for the old data to remain current while new data is periodically reloaded in the background. (The fact that someone might therefore see data that is six minutes old isn't a big issue - the data isn't that time sensitive). This is something that I can write myself, but it would be useful to know if any alternative caching engines (I know names like Velocity, memcache) support this kind of scenario. Or am I missing some obvious trick with the standard ASP.NET data cache?
We are using HttpRuntime.Cache API in an ASP.NET to cache data retrieved from a database.
For this particular application, our database queries feature a LOT of parameters, so our cache keys look something like this:
table=table1;param1=somevalue1;param2=somevalue2;param3=somevalue3;param4=somevalue4;param5=somevalue5;param6=somevalue6... etc...
we have so many parameters that the cache key is several hundred characters long. is there a limit to the length of these cache keys? Internally, it is using a dictionary, so theoretically the lookup time should be constant. However, I wonder if we have potential to run into some performance/memory problem.
I have use Nhibernate in my MVC Project by me known, Nhibernate have cache on Session and Object. now, I want use HttpContext.Current.Cache (system.web) for cache data something in project. my code same that have problem, haven't it. and that's right or wrong.
View 2 RepliesI'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 need to enable caching in my asp.net application, but I do not want to use the webserver's memory for holding cache objects. If I add the page directive for output caching will the page be stored in the asp.net cache object?
View 2 RepliesI want to be able to maintain certain objects between application restarts.
To do that, I want to write specific cached items out to disk in Global.asax Application_End() function and re-load them back on Application_Start().
I currently have a cache helper class, which uses the following method to return the cached value:
return HttpContext.Current.Cache[key];
Problem: during Application_End(), HttpContext.Current is null since there is no web request (it's an automated cleanup procedure) - therefore, I cannot access .Cache[] to retrieve any of the items to save to disk.
Question: how can I access the cache items during Application_End()?
Im building a image gallery which reads file from disk, create thumbnails on the fly and present them to the user. This works good, except the processing takes a bit time.
I then decided to cache the processed images using the ASP .NET Application Cache. When a image is processed I add the byte[] stream to the cache. As far as I know this is beeing saved into the system memory. And this is working perfect, the loading of the page is much faster.
My question is if there are thousands of images which gets cached in the Application Cache, will that affect the server performance in any way?
You know I have the way to Cache the data I've got from the SQL Server over data caching. In addition I can output cache web user controls.Whats about a web user control contains data from a SQL database? Does it make sense to cache the data and also cache the control?What is the best solution for the combination of these two components?
View 1 RepliesIn my opinion, these architectures have some differences, such as:
1. 3-layer is a linear architecture, but MVC is a triangle architecture.
2. Presentation Layer of 3-layer includes View and Controller of MVC? And Model of MVC includes Business Layer and Data Access Layer of 3-layer
I think 2 differences above are not obvious or are incorrect!
in one of the application i have been reffering connection string is stored in appsettings! till now i have been storeing the connection in <connectionstring/> element. But, what is the correct way?
So my quetion is, What is the differences between <connectionstring> and <appsettings> in web.config, are there any specific reason why i should or should not be storing connection string in appsettings? Are there any rules / guidlines provided to follow? Or is this completely the choice of the developer?
What are the differences between aspx and jspx? and Why should I choose aspx or jspx?
what is the best software to develop web poject with jspx?
What's your opinion of the following job interview question?In the requirement it never mentions about to have classic ASP experience.
But the question is "What are the differences between ADO.NET DataSet and ADO Record Set?".
I think that I am confuse here. Now I am using WebParts as they being used on 2.0 framework (like they are using on TheBeerHouse kit)
But in most of the forums they talk about SharePoint. Does sharepoint means webparts as I know them, or this is a new version of the webparts?
I am using asp.net and the .net framework 2.0. I may be able to upgrade the servers to 3.5 if the solution is compelling enough. Here is the problem.I have two pieces of xml.I'll refer to piece number 1 as the template and piece number 2 as the actual.Here's a basic example:template:
<questions>
<question1 msg="1234">
<answer></answer>
[code]...
We have a little debate and need to clear it up?
View 4 RepliesWhat is the difference between validateRequest (which validates form and querystring values) and also enableeventvalidation, which works on post/call backs? In specific, what confuses me is that validateRequest can only be possible by a postback as this is how form values etc will be picked up?
View 1 Replieswhat is the best way to compare two objects and find the differences?
Customer a = new Customer();
Customer b = new Customer();
differences of various Authentication Modes(windows,passport,form).
View 14 Replieswhat are the differences between .aspx and .ashx pages. I use ashx now when I need to handle a request that called from code and return with a response.
View 3 Replies