Questions regarding cache algorithms by applications and implementations of information caching by database engines and other information repository and presentation applications.

learn more… | top users | synonyms (1)

1
vote
1answer
22 views

Ring buffers for data with unknown maximum size

I see ring buffers are very useful with their speed and if you have a known maximum buffer length they make a lot of sense. Let's say in the scenario where you have streaming data, but the playing ...
2
votes
1answer
71 views

Persistence Strategies - Filling a cache strategy

Let's say I have an interface IDataAccessObject<TSource> with CRUD methods to access a data source. I have an implementation StrategyDataAccessObject<TSource>, which uses an strategy ...
1
vote
0answers
40 views

Difference between application cache and object cache

I'm reading Martin L. Abbott, Michael T. Fisher's Scalability rules: 50 principles for scaling Web sites, and in rules 24 and 25 they talk about Application Caches and Object Caches respectively. My ...
12
votes
5answers
766 views

How to avoid violating the SRP in a class to manage caching?

Note: The code sample is written in c#, but that shouldn't matter. I've put c# as a tag because I can't find a more appropiate one. This is about the code structure. I'm reading Clean Code and trying ...
7
votes
3answers
234 views

Are there CPUs that perform this possible L1 cache write optimization?

When the CPU with an L1 cache does a write, what normally happens is that (assuming that the cache line that it is writing to is already in the L1 cache) the cache (in addition to updating the data) ...
0
votes
1answer
87 views

Python - Cache function and decorator

I am playing with cache functions using decorators. First, I use a generic function def memorize(func): cache = {} print "printing cache" print cache print "cache printed" ...
2
votes
0answers
63 views

Caching authenticated requests for all users

I am working on a web app that must deal with very large impulses of simultaneous users, who need to be authorised, to request identical content. In it's current state, it's totally crippling to even ...
0
votes
1answer
95 views

Can I use a timestamp parameter for cache invalidation?

I am considering a scheme for passing a timestamp value in a cached response, and then sending it back to the service to perform cache invalidation. I'm wondering if that's a valid approach. Is that a ...
0
votes
1answer
358 views

Improving performance with caching of files in C# [closed]

EDIT: You were right, the problem is not checking if a file with the same name exists but the connection. I made a mistake measuring the time with StopWatch and included a part which used the network ...
0
votes
3answers
227 views

Forcing Cache Refresh

I'm updating an existing tomcat web application to read certain resources from a REST API. Currently the application reads them from flat files. Since the application is very critical, I added a ...
1
vote
1answer
211 views

How should I handle the fetching of cached data in iOS

I'm developing an app at work, this is my first big application and in my smaller projects I didn't use caching at all. What's currently happening When the user logs on for their very first time ...
4
votes
6answers
226 views

Class design, responsibility granulation, efficiency and performance

I am in a design dilemma. I have a set of data that can be interpreted in numerous ways, but I cannot really decide how finely grained should it be. To illustrate it with some simple code: class Base ...
1
vote
0answers
73 views

Saving and retrieving multiple cached json/txt data files

I am working on some numerical programming and need to generate the results for a model given a variety of input parameters. Since the model takes a while to run, I was planning to save the data to ...
1
vote
0answers
79 views

Using a distributed system as an alternative to disk storage

So, one of the differences between "main memory" and disk storage is durability -- the data on hard disks will stay accessible and unaffected even if the host machine crashes or loses power. One can ...
0
votes
1answer
96 views

Optimizing and caching frequently accessed but rarely updated Tables

My app has some tables that will be rarely updated, probably just once in the beginning and at the system setup. Despite that, they will be frequently accessed. Almost every operation depends on ...
0
votes
1answer
70 views

Redis for caching

I've heard a lot of positive about Redis but have not used it myself. Now I want to add a cache layer for my web app to reduce the DB load, and I suppose Redis is fine for this. But I don't clearly ...
1
vote
2answers
140 views

Caching query results vs Querying each time (finding a middle ground)

This is kind of an expansion on a previously asked question Some background info: Querying Over 5,000 items from SQL database that eventually get sorted into a list depending on who the user ...
4
votes
1answer
193 views

Reuse already fetched data for request

I have action that fetches user model from db to check access. Then I have method that in some cases requires same model. function checkAccess(req, res, next) { var data = ...
1
vote
1answer
68 views

Cache policy categorization

From what I search online, there are 2 most common policies used in cache access: Cache aside Read through + Write through But there are some other policies like: For write hit case: Write ...
1
vote
0answers
95 views

Why does the EF query plan cache eviction algorithm reduce the cache to its cleanup trigger size, causing a perpetual cleanup?

The cache eviction algorithm for query plan caching in Entity Framework is described in section 3.2.2 as this: Once the cache contains a set number of entries (800), we start a timer that ...
0
votes
1answer
123 views

Why are the test values the same for FIFO and LRU? [closed]

I had a computer science assignment where we compared FIFO, LRU and random policy for a cache memory. FIFO and LRU were equally good as improvements to a random policy. Why? Is it just a coincidence? ...
1
vote
2answers
185 views

Is storing data that rarely changes in-memory a good candidate for a singleton/cache?

I have a class called DataPoint that is defined like the following. Currently, it goes through each property on an object and based on the DataPoint, it does some formatting like padding, trimming, ...
0
votes
0answers
65 views

What is the design pattern name for a class that handles 2nd level caching? [duplicate]

I have a system where I want to start introducing some 2nd level caching. I want to abstract data access a bit and allow some type of other class to do the dirty work of fetching a DTO; it will check ...
30
votes
8answers
4k views

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 ...
8
votes
1answer
237 views

Best way to accelerate data access to two data warehouses?

I am embarking on a business intelligence project which will require abstracting access to two existing data warehouses. I need to design an application architecture to allow self-service business ...
1
vote
1answer
131 views

Running an algorithm against a large dataset

We have a python application which does a DFS search against data in a database. Right now, that data is small so I can hold everything in a python container but the data is going to grow and there ...
0
votes
0answers
31 views

Cache Memory Vs Main Memory [duplicate]

Why is the access time of the cache memory lesser than the access time of the main memory? I have tried looking at the sites as - tutorialspoint.com, education-portal.com etc. I know that the ...
24
votes
3answers
3k views

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 ...
2
votes
1answer
55 views

Declarative caching on Collections

I am interested in using Spring's Cache Abstraction on a module that I am working with but all data operations are on collections to avoid multiple datasource invocations, so I am not sure I have a ...
2
votes
3answers
180 views

Updating particular properties of EF objects every X amount of days in MVC

I'm building an MVC ASP.NET IMDb-like website which presents various information about movies to users, relying on 3rd party APIs to (initially) fetch movie info. The IDs representing each movie on ...
1
vote
1answer
780 views

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 ...
1
vote
1answer
94 views

Possible to refactor these methods that contain the same logical flow?

I have many methods in many repositories that have the same logical flow: Retrieve value from Cache Check value If no value, fetch from Database Update Cache Return value Is there a way to ...
2
votes
1answer
584 views

Understanding memory update propagation in x86/x86-64 CPU L1/L2/L3 caches and RAM

I'm trying to understand in a general sense how L1/L2 (and now L3 caches) are updated and how the updates are propagated in a multi-core x86/x86-64 CPU to the other cores and eventually RAM. Assuming ...
0
votes
2answers
395 views

Pattern for caching DAOs: strategy or decorator?

I'm building a php system with the Services/DAOs/Domain Models pattern, and now is the time to implement a caching system for the DAOs. Would you use a decorator pattern, or maybe the strategy ...
3
votes
1answer
225 views

Object caching in this code too expensive?

I'm having some trouble with a game developed in Java which is kinda slow. I benchmarked it a little bit and found the problem: most of the time, the JVM is in the Object.<init>() since there ...
2
votes
2answers
172 views

Serving a Website as only Cached HTML Pages

Lets say that I want to develop a website where all pages will be dynamically generated and 'printed' into static HTML files. I will then serve these HTML files from a container (such as an Amazon ...
1
vote
1answer
1k views

Redis strategy for cache item dependency

I'm implementing cache structure using Redis, my domain is like this: There are multiple categories (3000+ categories). Each category contains multiple questions (around 20-30 questions per ...
2
votes
0answers
346 views

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 ...
0
votes
1answer
199 views

design for buffering or queuing data streams to replace database

We have a system (ms stack, .net, sql) that receives data from thousands of remote devices (several independent readings/min). We currently save all the data to a db as it arrives and a second service ...
2
votes
1answer
138 views

ASP.NET how to handle external application settings

I'm converting an application from C# WebForms to MVC. The application gets settings from a centralized location using Web Services. These are settings you would typically find in a Web.Config, but ...
10
votes
2answers
3k views

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 ...
0
votes
1answer
53 views

Storing and presenting custom table data

I have a web site upon which I want to provide users the ability to create tables of data. These tables will come from a predefined list of table definitions of which I will be adding to myself. This ...
1
vote
1answer
163 views

Where to store front-end data for “object calculator”

I recently have completed a language library that acts as a giant filter for food items, and flows a bit like this :Products -> Recipes -> MenuItems -> Meals and finally, upon submission, ...
2
votes
4answers
192 views

Optimizing code by using registers, but what if they are not enough in number?

One way to optimize code is to minimize the access to arrays and use variables instead, because that way we use registers instead of loading data to cache memory. For example, if in a loop I'm going ...
1
vote
1answer
245 views

URLs with variable query strings and cache

I am developing a media server, the basic functionality is to serve an image, which is done the following way /media/:id where :id is the id of the image. You may want to ask for a specific size, ...
2
votes
1answer
308 views

PHP Cache Strategy - Genius or Sheer Stupidity?

I have a shared hosting with limited capabilities. Memcache and mod_cache are not available to me. I would like to implement my own PHP caching method to cache the results of load-intensive SQL query. ...
3
votes
1answer
669 views

Caching large amount of ajax returned objects

I'm building an application which fetches large amount of items with ajax requests via other application API. It returns me 6k - 30k js objects which are used multiple times across various application ...
1
vote
2answers
196 views

Image caching when rendering the same images on different pages [closed]

I'm told to think about caching of images that will be displayed on the page. The images will be repeated throughout the website on different pages and I'm told to figure out the best way to cache ...
1
vote
0answers
44 views

efficient caching with complex user rights

I am currently learning about memcached/redis, and I am trying to figure out how could I use this kind of technology at work. Now I understand that you should mostly cache data which is common to ...
1
vote
1answer
144 views

Cache concurrency: ensuring latest version in cache

We have a data service app working on object graphs. We place some complex graphs in a (memory) caching tier as a single data item, so as to avoid the length of time to retrieve every individual data ...