Questions regarding cache algorithms by applications and implementations of information caching by database engines and other information repository and presentation applications.
Questions tagged [caching]
266 questions
622
votes
13 answers
So Singletons are bad, then what?
There has been a lot of discussion lately about the problems with using (and overusing) Singletons. I've been one of those people earlier in my career too. I can see what the problem is now, and yet, there are still many cases where I can't see a…
Bobby Tables
- 20,616
62
votes
6 answers
Why is CPU cache memory so fast?
What makes CPU cache memory so much faster than main memory? I can see some benefit in a tiered cache system. It makes sense that a smaller cache is faster to search. But there must be more to it.
ConditionRacer
- 5,732
44
votes
3 answers
Caching at business layer vs Caching at Data Layer
I have always worked on projects where caching was done on DAL, basically just when you are about to make the call to database, it checks if data is already there in the cache and if it is, it just doesn't make the call and instead returns that…
Emma
- 645
34
votes
9 answers
How can QA staff test caching logic that they can't see?
I just implemented a caching layer in my web application, and now I'm wondering how QA is supposed to test it, since caching is transparent to the user.
One idea I have is to put logging in the methods that invoke the code that populate the cache,…
Joshua Frank
- 587
33
votes
2 answers
Writing low latency Java
Are there any Java-specific techniques (things which wouldnt apply to C++) for writing low latency code, in Java? I often see Java low latency roles and they ask for experience writing low latency Java- which sometimes seems a little bit of an…
user997112
- 1,479
- 3
- 19
- 24
31
votes
3 answers
Dealing with browser cache in single-page apps
I'm trying to figure out how to properly handle the web browser cache for single page apps.
I have a fairly typical design: several HTML, JS and CSS files implementing the SPA, and a bunch of JSON data that's consumed by the SPA. Problems arise when…
Josh Kelley
- 11,131
20
votes
6 answers
Best practices for unit testing methods that use cache heavily?
I have a number of business logic methods that store and retrieve (with filtering) objects and lists of objects from cache.
Consider
IList AllFromCache() { ... }
TObject FetchById(guid id) { ... }
IList FilterByPropertry(int…
NikolaiDante
- 898
16
votes
4 answers
What is important when optimising for the CPU cache (in C)?
Reading these two questions, I see that understanding CPU caching behaviour can be important when dealing with large amounts of data in memory. I would like to understand the way the caching works to add another tool to my optimisation toolbox.
What…
Timothy Jones
- 271
15
votes
1 answer
Relation between cache line and memory page
If I am correct, a page in a main memory is the smallest unit unit for transfer data between the main memory and an external storage device, such as a hard disk. A cache line of a main memory is the smallest unit for transfer data between the main…
Tim
- 5,545
15
votes
2 answers
Using Memcached: is it good practice to update the cache when updating the database?
This question is about best practices in architecture.
Our Current Architecture
I have a PHP class that accesses MySQL for user info. Let's call it User. User is accessed many times, so we have implemented layers of caching to reduce load.
The…
Stephen
- 2,199
14
votes
5 answers
How can I efficiently diff a CSV file against a database?
I have an inventory of products stored in Postgres. I need to be able to take a CSV file and get a list of changes—the things in the CSV file that are different to what is in the database. The CSV file has about 1.6 million rows.
The naive approach…
Isvara
- 630
- 6
- 18
14
votes
0 answers
Caching Strategy: WCF Buffer pooling and size
I am currently trying to understand the best configuration for caching. I am using Azure In-Role caching (currently Colocated, but Dedicated at a later point) in a Web Api 2 application in .NET 4.5.1.
The transportProperties element in…
Dave New
- 897
14
votes
1 answer
Why do some websites showing 0 bytes in Chrome's developer tools
I am doing a page speed optimization for my website and studying how other websites do it. I noticed that some websites such as as Facebook or Ringgitplus show 0 bytes for some of their resources in Chrome's developer tools, Network tab, while the…
kecebongsoft
- 433
14
votes
3 answers
What are best practices for caching paginated results whose ordering/properties can change?
What is the best practice for caching paginated search results whose ordering/properties can be changed?
Say, in my application, someone wants to see the last 20 discussion threads (out of 10,000). A request would be sent to the database, via…
goodsquishy
- 355
14
votes
2 answers
Shared Cache - Invalidation Best Practice
I'd like to know what would be a better approach to invalidate/update cache objects.
Prerequisites
Having remote memcached server (serving as cache for multiple applications)
All servers are hosted by azure (affinity regions, same data…
lurkerbelow
- 1,009