0

I have a MVC2 web app without a database that is being hosted by IIS7. The model is a custom index of some properties of a filesystem, and right now the index is stored in memory. The problem is that on a regular basis, the data stored in memory gets released, and the index must be recreated. Maybe the best solution would be to serialize the index object and load it when the index gets released, but it would be much simpler if I could prevent the data from going anywhere.

1
  • Why can't you just use a database? Commented Aug 26, 2010 at 11:59

2 Answers 2

1

Anytime there is no activity for a certain amount of time or IIS recycles the process you are going to lose any data in memory so if you require that information, you are going to need to persist it in some way and retrieve it when the memory is cleared.

Have you considered having this data in a persistent xml file or serialized to a file on the server?

If it gets cleared from memory you could check for that case and then just reload the file back into the application cache.

Sign up to request clarification or add additional context in comments.

Comments

0

To allow the data to survive you are going to have to move it outside the pervue of IIS - and that means either an XML store (in App_Data, Isolated Storage or somewhere else), a Database, or a service.

I mention a service because, while its potentially overkill, I imagine that there is some caretaking that needs to be done with this data as well? Removing stale entries, adding new entries and generally taking care of housekeeping? Putting all of that into a service allows the data to persist outside of the limits of IIS (but beware how far this is taken, as at some point you may just be reinventing some aspects of a database server anyway).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.