I am using Dynacache to cache data that will be eventually returned from a service call - to get things working I am just stubbing the data returned. I am using SimpleInjector for DI and got Dynacache registered with it as pointed out in the answer I got to a previous question
So I have an integration project within my solution which contains the method I want to cache - which currently looks as below:
[CacheableMethod(30)]
public virtual List<MyResponse> GetDataByAccountNumber(int accountNumber)
{
var response = StubResposne();
return response;
}
With implementation above Dynacache should cache the data for 30 secs and then clear it. However if I set a breakpoint on the first line in my private StubResponse() method the first time I hit the webpage which uses that data the breakpoint gets hit as expected and the data is returned. However if I refresh the page straight away again I was expecting that as the data would have been cached (as its within 30 secs) then the breakpoint would not have been hit but it is hit everytime?
Is there something incorrect with how I am using Dynacache?
For registering with SimpleInjector it should be done as below:
Once I done this Caching worked as expected.
Updated with Full test sample Program
}