0

Query 1:

I have a web app with an xml file of 100 lines approximately; When my web app is running, I need to write values in that xml file(twice) and read values from that application many times; Once all values are updated in xml file, I tried to read the values in 2 ways,

  1. I will de-serialize the xml file and store all the values in a static object and use it in my web app;

  2. Each time when I need data, I will parse exactly to the respective xml element and get the value;

My doubts:

  • If I go with first approach, is holding values in a static object, a wrong approach which may cause memory consumption?

  • If I follow second approach, I frequently parse xml file; Is this right instead?

Please tell which is the correct approach for my use case;

2
  • Side note: caching is hard, and using static variables is generally worst option to implement caching , especially in ASP.Net. Commented Jul 16, 2015 at 5:21
  • 1
    Please don't ask 2 unrelated questions in one post. Second set should definitely be duplicate of existing question - make sure to search before asking separate question... Commented Jul 16, 2015 at 5:23

1 Answer 1

1

Query 1: You should go with the first option you mentioned because it is really expensive to go each time to the xml file and get the specific data.

But you don't need to put in into a static object, you can deserialize it into some local variable you pass through the functions or use a global variable (try to avoid using globals).

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

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.