2

How can I get the dropbox items in cache, in MVC?

I have tried the following, but it calls the page function each time.

What could be the issue or the right way to do it?

Please suggest.

[OutputCache(Duration = 10, Location = System.Web.UI.OutputCacheLocation.Server,
      NoStore = true, Order = 0)]
    public IEnumerable<SelectListItem> GetRegions()
    {
Anuj Balan
  • 7,629
  • 23
  • 58
  • 92
amit patel
  • 2,287
  • 8
  • 31
  • 45
  • Doesn't `NoStore = true` tell the framework to NOT store the cached items (when using server side cache) = have to generate the result every time? – jgauffin Mar 20 '12 at 10:26
  • I have tried already, if i put the code in controller it works but it is not possible for me to keep the code there – amit patel Mar 20 '12 at 10:36
  • ahhh. you can't put the attribute anywhere but in the controller. – jgauffin Mar 20 '12 at 10:49

1 Answers1

1

You should have it in your controller on those actions there

Lasse Edsvik
  • 9,070
  • 16
  • 73
  • 109
  • it is not in the controller, it is a seperate project of sqlite archit. and where system.web.mvc is added as reference – amit patel Mar 20 '12 at 10:30
  • The thing is i am not able to use on controller due to code issues in my project. This is a normal class file – amit patel Mar 20 '12 at 10:31
  • If you have large amounts of data, use an autocomplete using json instead that limits the amount of data sent to client. – Lasse Edsvik Mar 20 '12 at 10:55