Questions tagged [objectcache]
36 questions
18
votes
3 answers
.NET 4 ObjectCache - Can We Hook Into a "Cache Expired" Event?
I've got a simple object being cached like this:
_myCache.Add(someKey, someObj, policy);
Where _myCache is declared as ObjectCache (but injected via DI as MemoryCache.Default), someObj is the object i'm adding, and policy is a CacheItemPolicy.
If i…

RPM1984
- 72,246
- 58
- 225
- 350
7
votes
2 answers
ObjectCache in .net Windows Applications
Is the ObjectCache class included in .Net Framework 3.5?
If not, is there an alternative for storing objects in cache, ( in windows applications not asp.net)?
And does anyone have any online resources or code snippets that demonstrate how to use the…

Hassan Mokdad
- 5,832
- 18
- 55
- 90
6
votes
1 answer
Entity Framework 6 and ObjectCache: saving issues
I'm using Entity Framework 6 and ObjectCache to cache some entities that don't change often. But I faced an error when trying to save entities that are cached because they were retrieved from a different context. Before saving, I verified and the…

Francisco Goldenstein
- 13,299
- 7
- 58
- 74
4
votes
1 answer
Caching Data .Net 4.0 (Asp.NET)
Can anybody explane me what is "CacheSpecificEviction" in detail and how to avoid it?
I am geting this in CacheEntryRemovedArguments.RemovedReason.

manish
- 312
- 3
- 9
3
votes
1 answer
Can I find the last time a MemoryCache item was accessed?
In a .NET 4 MemoryCache, is there a way to find when an item was last accessed? I'm sure it's being tracked internally, since CacheItemPolicy has the SlidingExpiration property. But I haven't been able to find anywhere to read it.
Big picture, I'm…

Sean U
- 6,730
- 1
- 24
- 43
2
votes
1 answer
ObjectCache does not contain item immediently after setting it consistently
All-
I am attempting to create a server-side cache using the new ObjectCache object. For whatever reason, the following is throwing an exception...
_cache.Set(CacheKey.LOCATIONS, cachedLocations, DateTimeOffset.Now.AddHours(2));
…

Onosa
- 1,275
- 1
- 12
- 28
2
votes
2 answers
Func DoSomething: Type [...] Controller+<>c__DisplayClass0_0 is not marked as serializable
I'm trying to implement FileCache (https://github.com/acarteas/FileCache) which is based on ObjectCache.
I'm trying to check a cache object for its existence, or add it if required and return. When the object does not exist however, the delegate is…

ExternalUse
- 2,053
- 2
- 25
- 37
2
votes
0 answers
Using Redis as an Object Cache with Woocommerce
i'm trying to run a big ecommerce using Woocommerce and i'm facing some problems. Website has 10000 products per language ( 2 languages ) with many of them variable.
For now i'm trying to cache it using W3 Total Caches Page Cache ( Disk Enchanced )…

sarakinos
- 666
- 11
- 28
2
votes
0 answers
asp.net mvc, EF with memorycache high memory usage
We have an asp.net MVC website(nopcommerce 3.6) (Site 1) using Entity framework and inmemorycache. The memory consumption of the site is very high. Reaches to ~14gb.
The application sits in a windows 2008 server with 16gb of RAM.
I need help in…

Suba Ram
- 31
- 2
2
votes
0 answers
RestSharp using it static with caching and repeatedly making CRUD calls to web api seems a bit slow
I am using RestSharp to call Web Api repeatedly for all CRUD operations. Now what I am doing it that RestClient ends up getting wrapped into caching object. Is this bad / causing it to be slow?
public class ReferenceDS:IReferenceDS
{
private…

Timothy Fisher
- 185
- 1
- 11
1
vote
0 answers
Missing some data stored through object caching in memory
I'm using ASP.NET MVC3.I've cached some data using object caching in memory.In some cases,it opted out some caching data.
for example.
I've stored array of integer number;
int[] i;
i[0]=0;
i[1]=1;
i[2]=2;
i[3]=3;
i[4]=4;
i[5]=5;
and cached array…

Dharmik Bhandari
- 1,702
- 5
- 29
- 60
1
vote
1 answer
System.Runtime.Caching "forgets" about caching when the debugger is attached
I have a suite of application components that require the persistence of a large business object collection in order to achieve reasonable performance. This is essentially data that is read from the database and hydrated into objects for later…

StingyJack
- 19,041
- 10
- 63
- 122
1
vote
3 answers
In .NET, why is ObjectCache the preferred type over MemoryCache?
So many examples of using the memory cache in .NET (including the official docs) instantiate it with:
private readonly ObjectCache memoryCache = MemoryCache.Default;
Is there any reason to prefer this over:
private readonly MemoryCache memoryCache…

TomDane
- 1,010
- 10
- 25
1
vote
1 answer
C# Unit Test NSubstitute Unable to Set Value in ObjectCache
I am unable to insert a cache entry in ObjectCache with Set in my unit tests.
var objectCache = Substitute.For();
objectCache.Set("TestKey", object, Arg.Any());
When I step into my code
var cachedData =…

Songtham T.
- 185
- 1
- 2
- 15
1
vote
1 answer
How to use Object caching on View page MVC
I am working MVC project. I am having access of view page only in one project which I load using view engine.
Now I want to use object caching on view page as I do not want to call service method every time.
Is there any way to do this? Any help…

Ankita
- 1,416
- 4
- 17
- 42