Questions tagged [asp.net-cache]

20 questions
14
votes
1 answer

How to invalidate Web API cache from another Controller(ASP.NET Web API CacheOutput Library)

I have used ASP.NET Web API CacheOutput Library for my asp.net project for web API and it working fine, but have another controller from where I have a POST method and I would like to invalidate my cache from that…
Suresh
  • 1,131
  • 1
  • 15
  • 28
5
votes
4 answers

Cache == null? Is it possible?

Is it legal to make the following statement: if(Cache[CACHE_KEY] == null) { //do something to form cache } else { //do something else that uses cache } I'm not sure my program is actually functioning properly (even though it compiles) and…
locoboy
  • 38,002
  • 70
  • 184
  • 260
4
votes
1 answer

DonutOutputCache is not clearing cache when using variable

I have an ActionResult which i want it to be cached based on the id [DonutOutputCache(Duration = 3600, VaryByParam = "product_Id")] public ActionResult ProductInfo(Guid product_Id) { System.Threading.Thread.Sleep(3000); return…
Catalin
  • 11,503
  • 19
  • 74
  • 147
3
votes
1 answer

Is ASP.Net State Server an elegant solution?

We have an ASP.Net MVC project that will start with a single web server but will likely soon scale into a small web farm. As ASP.Net Authentication stores a UserID, and data caching may also be useful, we will likely need to make the jump to state…
alchemical
  • 13,559
  • 23
  • 83
  • 110
3
votes
1 answer

Retrieving image from HTTPRuntime Cache

I am trying to save and retrieve an Image from HTTPRuntime Cache but I am getting an exception. I am able to save a stream to cache but when I try to retrieve it I get an exception saying: the request was aborted. The connection was closed…
Abhi.Net
  • 722
  • 3
  • 11
  • 37
2
votes
2 answers

Is there a way to use use a cache profile when manually adding items to the cache?

I have output caching in my application configured using output cache profiles in the web.config. It is very convenient to be able to setup caching on all the output items that need it and then be able to adjust all the cache settings in one…
Zack
  • 2,291
  • 2
  • 23
  • 38
2
votes
1 answer

ASP.NET - Is everything I store in Cache part of the w3wp process?

It is my understand that the ASP.NET Cache is part of the w3wp process, meaning writing to and reading from it does not cross process boundaries does not require marshalling does not require or perform serialization of objects placed in it (All…
Alex
  • 75,813
  • 86
  • 255
  • 348
1
vote
1 answer

asp.net webservice cache extend expiration

I haven't found anything so I dont believe what I want is possible. I want to reset the sliding expiration of a cache variable every time it is accessed. public class MyCache { public static object CachedItem { get { string key =…
Tom Fobear
  • 6,729
  • 7
  • 42
  • 74
1
vote
1 answer

HttpContext.Current.Items is too fast to access item, but How?

I wrote simple test add 100 items to [Collection] read 1000000 times from [Collection] randomly When [Collection]==HttpContext.Current.Items it takes 50 ms [Collection]==HttpRuntime.Cache it takes 430ms [Collection]==HashTable ||…
sh1ng
  • 2,808
  • 4
  • 24
  • 38
1
vote
0 answers

Session, FormsAuthenticationTicket, store data about the user?

I'm building a web application that needs to be able to scale. We want to store a connection string, an object that says what organization the user is working on right now and the identity of the user. We could serialize down this and send through…
NPehrsson
  • 1,548
  • 18
  • 26
1
vote
2 answers

what techniques should be used to handle objects in asp.net Cache to prevent problems from multiple asp.net worker threads access?

since asp.net contains multiple threads that are executing at the same time. so if 2 threads access an object (simple or complex) that i got from the the asp.net httpcontext Cache. can't this lead to state problems on that object if these 2 theads…
Karim
  • 6,113
  • 18
  • 58
  • 83
1
vote
0 answers

.Net Enterprise Cache - refresh instantly?

I'm using Enterprise Library Caching for my MVC3 application. My code is something like this: object myLock = new Object(); public static MyEntity[] getMyEntities() { MyEntity[] res; res = getMyEntities(new…
Gonzalo
  • 45
  • 5
1
vote
1 answer

Replace nonmutable item in cache without triggering remove callback

Ok so say every time a user hits my web service I add an item to the cache: DateTime? token = HttpContext.Current.Get(TimeoutKey) as DateTime?; int hashkey = (email + password).GetHashCode(); if (token == null) { …
Tom Fobear
  • 6,729
  • 7
  • 42
  • 74
0
votes
0 answers

asp.net core tag with inline vuejs templates in razor views not working properly

What I am trying to do is similar to question in here Main reason for me to have this approach is that my application has a plugin system, so some plugins gets installed at a later time. Each plugin have it's own resources including vuejs logic.…
user2058413
  • 691
  • 3
  • 10
  • 28
0
votes
1 answer

ASP.net Cache overuse?

In a web project I perform a SELECT SQL query against an Indexed column of a table with 10-15 rows. I want to ask you if it's good to cache this query in server memory as this SELECT against indexed tables is light and fast and its not complex at…
Spyros
  • 540
  • 1
  • 7
  • 21
1
2