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 8871499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:00:26+00:00 2026-06-14T18:00:26+00:00

I realize that this might be a vague question the bequests a vague answer,

  • 0

I realize that this might be a vague question the bequests a vague answer, but I’m in need of some real world examples, thoughts, &/or best practices for caching data for a web app. All of the examples I’ve read are more technical in nature (how to add or remove cache data from the respective cache store), but I’ve not been able to find a higher level strategy for caching.

For example, my web app has an inbox/mail feature for each user. What I’ve been doing to date is storing typical session data in the cache. In this example, when the user logs in I go to the database and retrieve the user’s mail messages and store them in cache. I’m beginning to wonder if I should just maintain a copy of all users’ messages in the cache, all the time, and just retrieve them from cache when needed, instead of loading from the database upon login. I have a bunch of other data that’s loaded on login (product catalogs and related entities) and login is starting to slow down.

So I guess my question to the community, is what would you do/recommend as an approach in this scenario?

Thanks.

  • 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-14T18:00:27+00:00Added an answer on June 14, 2026 at 6:00 pm

    This might be better suited to https://softwareengineering.stackexchange.com/, but generally you want to cache:

    • Metadata/configuration data that does not change frequently. E.g. country/state lists, external resource addresses, logic/branching settings, product/price/tax definitions, etc.
    • Data that is costly to retrieve or generate and that does not need to frequently change. E.g. historical data sets for reports.
    • Data that is unique to the current user’s session.

    The last item above is where you need to be careful as you can drastically increase your app’s memory usage, by adding a few megabytes to the data for every active session. It also implies different levels of caching — application wide, user session, etc.

    Generally you should NOT cache data that is under active change.

    In larger systems you also need to think about where the cache(s) will sit. Is it possible to have one central cache server, or is it good enough for each server/process to handle its own caching?

    Also: you should have some method to quickly reset/invalidate the cached data. For a smaller or less mission-critical app, this could be as simple as restarting the web server. For the large system that I work on, we use a 12 hour absolute expiration window for most cached data, but we have a way of forcing immediate expiration if we need it.

    This is a really broad question, and the answer depends heavily on the specific application/system you are building. I don’t know enough about your specific scenario to say if you should cache all the users’ messages, but instinctively it seems like a bad idea since you would seem to be effectively caching your entire data set. This could lead to problems if new messages come in or get deleted. Would you then update them in the cache? Would that not simply duplicate the backing store?

    Caching is only a performance optimization technique, and as with any optimization, measure first before making substantial changes, to avoid wasting time optimizing the wrong thing. Maybe you don’t need much caching, and it would only complicate your app. Maybe the data you are thinking of caching can be retrieved in a faster way, or less of it can be retrieved at once.

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

Sidebar

Related Questions

I realize that this question has been asked 100times but none that I have
While I realize that this question has been asked once or twice ago but
I realize that the answer to this question is likely quite obvious (if somewhat
I realize that a SO user has formerly asked this question but it was
I asked this question in the restkit google group, but realize now that it
I realize this is a vague question, but I'm wondering if anyone else has
Note: I realize that this is probably an open-ended question, so go ahead and
This might be a silly question, but I'm a beginner in C#, so please
I realize this might be a confusing question so I will try and explain
I realize that this question has been answered before, and I have looked through

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.