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

  • Home
  • SEARCH
  • 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 128141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:35:17+00:00 2026-05-11T05:35:17+00:00

I’m constantly hearing about person y had performance issue x which they solved through

  • 0

I’m constantly hearing about person y had performance issue x which they solved through caching.

Or, how doing x,y,z in your programs code can hurt your caching ability.

Even in one of the latest podcasts, Jeff Atwood talks about how they cache certain values for speedy retrieval.

There seems to be some ambiguity in the terms "cache" and "caching" and it has led me to be confused about it’s meaning in different cases. Whether you are referring to application or database caching, cpu, etc and what that means.

What is caching and what are the different types?

From context I can get a sense of it, to store an oft retrieved value into main memory and have quicklook up access to it. However, what is it really?

This word seems to be used in a lot of different contexts with slightly different meaning (cpu, database, application, etc) and I’m really looking to clear it up.

Is there a distinction between how caching works in your applications vs your database caching?

When someone says that they found a piece of code that would hurt caching and after they fixed it, it improved the speed of their app, what are they talking about?

Is the program’s caching something that is done automatically? How do you allow values to be cached in your programs? I’ve often read users on this site say that they cached a value in their application, I sit here and wonder what they mean.

Also, what does it really mean when someone talks about database caching? Is this simply a feature they turn on in their database? Do you have to explicitly cache values or does the database pick which ones to cache for you?

How do I begin caching items myself to improve performance?

Can you give me some examples of how I can begin caching values in my applications? Or again, is this something that is already done, under the hood and I simply have to write my code in a particular way to allow "caching"?

What about database caching, how do I begin that? I’ve heard about things like memcache. Is this type of utility required to cache in databases?

I’m looking to get a good distinction between caching in applications vs databases, how they are used and how it is implemented in both cases.

  • 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. 2026-05-11T05:35:18+00:00Added an answer on May 11, 2026 at 5:35 am

    Caching is just the practice of storing data in and retrieving data from a high-performance store (usually memory) either explicitly or implicitly.

    Let me explain. Memory is faster to access than a file, a remote URL (usually), a database or any other external store of information you like. So if the act of using one of those external resources is significant then you may benefit from caching to increase performance.

    Knuth once said that premature optimization is the root of all evil. Well, premature caching is the root of all headaches as far as I’m concerned. Don’t solve a problem until you have a problem. Every decision you make comes at a cost that you’ll pay to implement it now and pay again to change it later so the longer you can put off making a deicsion and changing your system the better.

    So first identify that you actually have a problem and where it is. Profiling, logging and other forms of performance testing will help you here. I can’t stress enough how important this step is. The number of times I’ve seen people ‘optimize’ something that isn’t a problem is staggering.

    Ok, so you have a performance problem. Say your pages are running a query that takes a long time. If it’s a read then you have a number of options:

    • Run the query as a separate process and put the result into a cache. All pages simply access the cache. You can update the cached version as often as is appropriate (once a day, once a week, one every 5 seconds, whatever is appropriate);
    • Cache transparently through your persistence provider, ORM or whatever. Of course this depends on what technology you’re using. Hibernate and Ibatis for example support query result caching;
    • Have your pages run the query if the result isn’t in the cache (or it’s ‘stale’, meaning it is calculated longer ago than the specified ‘age’) and put it into the cache. This has concurrency problems if two (or more) separate processes all decide they need to update the result so you end up running the same (expensive) query eight times at once. You can handle this locking the cache but that creates another performance problem. You can also fall back to concurrency methods in your language (eg Java 5 concurrency APIs).

    If it’s an update (or updates take place that need to be reflected in your read cache) then it’s a little more complicated because it’s no good having an old value in the cache and a newer value in the database such that you then provide your pages with an inconsistent view of the data. But broadly speaking there are four approaches to this:

    • Update the cache and then queue a request to update the relevant store;
    • Write through caching: the cache provider may provide a mechanism to persist the update and block the caller until that change is made; and
    • Write-behind caching: same as write-through caching but it doesn’t block the caller. The update happens asynchronously and separately; and
    • Persistence as a Service models: this assumes your caching mechanism supports some kind of observability (ie cache event listeners). Basically an entirely separate process–unknown to the caller–listens for cache updates and persists them as necessary.

    Which of the above methodologies you choose will depend a lot on your requirements, what technologies you’re using and a whole host of other factors (eg is clustering and failover support required?).

    It’s hard to be more specific than that and give you guidance on what to do without knowing much more detail about your problem (like whether or not you have a problem).

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

Sidebar

Ask A Question

Stats

  • Questions 140k
  • Answers 140k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer My company fits in your range. Here's some stats to… May 12, 2026 at 7:59 am
  • Editorial Team
    Editorial Team added an answer The best you could probably do is look at the… May 12, 2026 at 7:59 am
  • Editorial Team
    Editorial Team added an answer You can achive this using state machine workflows easily. You… May 12, 2026 at 7:59 am

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.