Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7948133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:38:05+00:00 2026-06-04T01:38:05+00:00

I need to implement caching in Asp.net web application My need to store data

  • 0

I need to implement caching in Asp.net web application
My need to store data with different ID’s.
So which method is better ?

  1. Use a dictionary variable. Insert the data (key as ID and data as value).

        Dim mDict As New Dictionary(Of String, String)
        mDict .Add(bID, uwtTree.WriteXmlString(True, True))
        Cache.Insert("mTree", mDict) 
    

    Add it to a cache variable.
    Access the cache variable

         If Not Cache("mTree") is Nothing Then 
            'cast to dictionary and check ID exists , if exsitis get the data
         End iF
    
  2. Use cache variable for different IDs

         Cache.Insert(ID,data)
          ' each insertion for each ID
         If Not Cache(ID) is Nothing Then 
            ' get the data. '
         End IF
    

Which method is the best way ? Or is there any other method exists ?
I am using .Net 3.5 /IIS 7 (VB.Net). Thanks in advance

Way to Improve Performance and Memory Optimization

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T01:38:07+00:00Added an answer on June 4, 2026 at 1:38 am

    Without context it’s not possible to say which is “better”.

    But if you put a dictionary in the cache (option 1), better make sure it’s a thread-safe dictionary (such as the .NET 4 ConcurrentDictionary).

    The most obvious difference between the two approaches is that with option 1, cache item expiry will result in the dictionary with all items being removed at once. With option 2, individual items will expire independently.

    In response to the comment:

    i am having xml data and i will store in cache (data caching) as string. Is there any difference if i store it as XmlObject ?

    The main differences I see are:

    • String is immutable, so you won’t need to worry about thread-safety when accessing it. XML objects are not immutable – so you need to make sure you don’t modify the object retrieved from the cache (or use locks to make sure any such modification is thread-safe).

    • If you store a string, you will presumably parse it into an XML object each time you retrieve it from the cache, which will result in a potential performance penalty.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC 3 (Razor) Web Application, with a particular page which
I'm using the MapMaker to implement caching of data objects in my application: public
I am trying to implement caching in .Net such that the cached data is
I need a multi-threaded Map object to use in my web server's caching, and
I'm trying to fix a particular laboratory web application (written in ASP.NET). There is
I am trying to implement a caching pattern which may need to utilise Redis.
I'm currently attempting to implement APC caching as a datastore in my web application.
I need to implement a B+ tree which is adapted to be a k
I need to implement a Diff algorithm in VB.NET to find the changes between
I'm implementing a PHP script which will need some caching capabilities. I'm trying to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.