Repopulate Cache Every 30 Mintues With New Data?

Sep 13, 2010

I'm trying to build a process that will repopulate an item that was inserted into cache every 30 minutes. I inserted the item into Cached to expire after 30 minutes. I setup a delegate (http://msdn.microsoft.com/en-s/library/system.web.caching.cacheitemremovedcallback(v=VS.90).aspx) to be called when the cached item expired. My goal was when the delegate was called was to rebuild the item and insert it back into cached. The issue I found with the MSDN article above was that it was using a holding the page instance open until the delegate was called. Instead of had it call another class that was static (vb shared). This caused a different problem -- the delegate lost context. When I tried to add back into the cache the HttpContext.Current was null. Is there a way I can repopulate an item in cache every 30 minutes in ASP.NET without keeping page instances around? Note, I cannot use a sliding expiration date because the content will change.

View 1 Replies


Similar Messages:

Forms Data Controls :: Cannot Repopulate / Filter Datagrid With User Entered Value From Text Box

Feb 18, 2011

I have a Datagrid control which is populated with data from an Access database when the page loads - a simple 'Select *' command. This page also contains a text box and a button, the idea being that the user can then filter the data by entering a value in the text box and clicking on the button to pass the new parameter to the datasource.

However, I cannot get this to work, I know it has something to do with 'IsPostback', but I am at a loss. I have tried variations of the following in the code behind page but to no avail.

[Code]....

[Code]....

View 11 Replies

Forms Data Controls :: How To Repopulate Insertitemfields When Detailsview Insert Fails Sql Business Logic

Feb 7, 2011

After hitting the insert button the insert stored proc is run. if the record already exists then stored proc returns a specific value.I need to refill the details view textboxes with the values the user typed in.I am using the ItemInserted event handler.I seem to reference the control okay but the text doesn't change...even when I replace the command.parameter to just a literal text like "test".

TextBox tNPA = DetailsView1.FindControl("InsertName") as TextBox;
tNPA.Text = command.Parameters[0].Value.ToString();

So what am I missing. I also tried a detailsview1.databind() before and then tried after the above line and still no luck.

View 17 Replies

Data Cache Support Background Population Of Cache Entries?

Aug 1, 2010

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?

View 3 Replies

ADO.NET :: Use HttpContext.Current.Cache (system.web) For Cache Data Something In Project

Sep 13, 2010

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 Replies

Forms Data Controls :: Gridview Recalculate, Then Repopulate Gridview Without Going Back To Database?

Mar 26, 2010

I want to make sure I go about this in an efficient manner. I have a gridview. On the gridview, I have some columns that are read only values . These values go through calculations based on values in a database. The stored procedure takes information in the database, does some simply calculations (this value * that value / another value type of stuff) then returns a recordset as a datasource for the grid.

Other columns on the gridview have values the users can enter data. I want to be able to provide a recalculate button that will run calculations based on the entered values which will change the readonly values and then repopulate the gridview's read only values without going back to the database. This recalculate button is not the save to the database button. The save to the database button will take the values in the user entered columns and save them to the database. Then, the next time the grid is called, the page calls to the database and loads the grid.

So, what I'm looking to do is allows for recalculations on a gridview, a gridview with about 24 columns and about 1000 rows. My first thought is to create a class that reads the gridview and then applies the business rules, then updates the gridview some how. Or, maybe have a dataset table thats i read the value from the user inputs, then apply business rules and then bind the gridview to the dataset table. Do any of you have thoughts here, maybe have done something like this?

View 9 Replies

MVC :: Repopulate Form With FormCollection?

Mar 2, 2010

Ive got a scenario where a form is filled in and the action picks it up as a FormCollection. It then carries out validation on it and if it fails sends it back to the form again, however i cant seem to get it to re-populate the form.

If i do something like:

[Code]....

So it just looks for name in whatever is passed over... ideally i dont want to involve a model unless it has all validated fine, but if there is no other way around it can populate a model and do the validation on the model instead...

View 9 Replies

Web Forms :: Page Will Not Repopulate After First Click?

Apr 19, 2010

I have written a page that accepts new information and then repopulates the page when a button is clicked. This is a simple task in C#, but seems very complicated in ASP.net. The code seems to work fine on the first click, but the after the first click, the page no longer repopulates. Closer examination reveals that although the values are changed on the page, the actual values held in memory remain the same; ergo, new results are the same as the old. Now...I see that on some controls (such as RadioButton) there is an automatic postback feature, however, I cannot find this for a button. Of course, I am presuming that the Postback is the problem....OR... perhaps it's something else? My preference is not to use javascript, but I of course will if that is the only way. I am still amazed that (after all this time) ASP still has to rely on Javascript for certain features.

View 11 Replies

Repopulate The View Model In MVC 2 After A Validation Error?

Mar 15, 2010

I'm using ASP.NET MVC 2 and here's the issue. My View Model looks something like this. It includes some fields which are edited by the user and others which are used for display purposes. Here's a simple version

public class MyModel
{
public decimal Price { get; set; } // for view purpose only
[Required(ErrorMessage="Name Required")]

[Code]....

But doing this, I get an error on UpdateModel(rec): The model of type 'MyModel' could not be updated.

View 3 Replies

Web Forms :: Dynamic Menu Repopulate After Postback?

Oct 29, 2010

[Code]....

Dynamic Menu repopulate after postback?

View 8 Replies

Web Forms :: Dynamic Menu Repopulate After Pageload?

Sep 30, 2010

[Code]....

dynamic menu repopulate after pageload?

View 9 Replies

AJAX :: Repopulate Cascading Dropdown Using Javascript And C#?

Dec 7, 2010

I want to call the webservice method for repopulating the contains of cascading dropdown.

I dont want to write onparentchange method.

Requirement is simple. But dont know how to proceed.

On parent selection four dropdown will populate.

Now if I select the first child dropdown then again acccording to the choice of parent and first dropdown second, third and fourth will populate. And like wise.

Now how to call the webservice methods after selection of first one to repopulate the containt of the second, third and fourth dropdown.

View 2 Replies

AJAX :: Repopulate Cascading Dropdown List Using Javascript

Mar 31, 2010

I've 2 dropdownlists, both are binded to a cascadingdropdown. Whenever I select an option in the 1st dropdownlist (parent), the options in the 2nd dropdownlist (child) will repopulate based on the options I selected in the parent dropdownlist. I need a javascript function to reset the options of both dropdownlists in their initial state (the prompt text).

I've tried changing the selectedIndex of the parent dropdownlist. However, this only changes the selected option in the parent dropdownlist. It does not reset the child dropdownlist to its initial state (which is supposed to be disabled and without any options). Need the script to reset the chained dropdownlists?

View 3 Replies

C# - Implement System.Web.Caching.Cache Object In A Controller To Cache Specific Query?

Mar 29, 2010

Is it correct to implement my caching object like this in my controller :

[code]....

And I Use it like this :

[code]....

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

New-Cache Parameters For AppFabric Cache When Storing.NET Session State

Jul 28, 2010

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.

View 1 Replies

C# - Maximum Length Of Cache Keys In HttpRuntime.Cache Object?

Feb 24, 2010

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.

View 1 Replies

Architecture :: Distributed Caching / Keeping Cache In Sync Between Multiple Webservers Or Even Better Farm Cache Management To Another Server?

Feb 26, 2010

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?

View 2 Replies

Is Page Output Cache Stored In.NET Cache Object?

Nov 2, 2010

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 Replies

C# - Application_End() Cannot Access Cache Through HttpContext.Current.Cache

Dec 12, 2010

I 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()?

View 4 Replies

C# - Web Application Cache Versus Database Cache

Jan 14, 2010

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?

View 3 Replies

Sql - Cache And Output Cache For Controls?

Oct 28, 2010

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 Replies

Custom Server Controls :: How To Programmatically Cache A Server Control And Add A Cache Dependency?

Feb 11, 2011

I 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?

View 2 Replies

C# - How To Add Data From Cache To A DataTable

Feb 17, 2010

I am embarrassed to ask, but what is the best way to add key/value pair data in cache (HttpRuntime.Cache) to a DataTable?

I'm currently dumping the key/value pair data from cache into a HashTable, which becomes the DataSource for a Repeater object. Unfortunately, I cannot sort the data in the Hashtable and therefore thought a DataTable (being the DataSource for the Repeater) would solve my dilema.

View 5 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







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