The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [caching]

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

Filter by
Sorted by
Tagged with
-2
votes
1answer
96 views

Map synchronization algorithm

Say I have two Map instances in JavaScript (or HashMap in Java, or Dictionary in C#), A and B. I want to synchronize B to A, so that B is a copy of A. I can't copy the reference and I don't want to ...
-1
votes
1answer
28 views

Order of deletion with web cache overflow

I'm creating an web app who uses a service worker to download its pages in the cache so I can use the web app offline. It is possible that the user doesn't connect to the internet for a while. I know ...
3
votes
1answer
120 views

Is LRU still a good algorithm for a cache with diferent size elements?

I am currently working on a project where I need to implement a cache with limited size. The most common eviction policy seems to be Least recently used (LRU), that simply discards the least recently ...
0
votes
0answers
51 views

How to elegantly allow for lookups/dropdowns to be loaded with items marked 'Inactive' without totally messing up caching?

Where the application has the ability to mark dropdown items 'inactive' - this means to the user that particular item is no longer in use and should not be shown in dropdowns. However, it is used on ...
1
vote
2answers
79 views

Cache maintained by caller app or by provider app in microservices inter-app communication?

Suppose there are app1 and app2 in a microservices. app2 needs to call app1's RESTful APIs. Cache is needed since the call will be frequent. So after a successful RESTful call, there will be cache ...
0
votes
0answers
26 views

How to cache timestamp based key values with a distributed cache?

I have a dataset in a key value store (similar to Cassandra). The data model is - Key - ServiceName / timestamp_in_milliseconds value - operation In the write side I get some operations for a ...
0
votes
2answers
79 views

How to handle user permission changes in SPA?

I have a SPA which at the beginning of application startup calls the backend API, sends a JWT and asks for the access permissions of the current user. SPA then caches the permissions in-memory and ...
2
votes
3answers
261 views

Is caching Access Tokens on the back end of a Web Application a good idea? (access_token storage best practices)

Let's suppose we have a Web Application that uses an Open Id Connect service provider, the Web Application uses the Authorization Code flow to get access to a different API, and therefore gets an ...
0
votes
0answers
120 views

Using signalR for streaming alongside a microservice architecture

I have a cluster of micro services with an exposed search API serving a client app. I want to "stream" in real time the aggregated results of a complex search. The search will be kicked of by the ...
1
vote
2answers
97 views

Design optimal read operation in my service

---- Description I'd like to optimize read operation in my service. It has basically put and get methods. On put I accept some numbers in a string format and put them into thread-safe cache with ...
0
votes
1answer
99 views

How to solve cache eviction when not using distributed cache in microservices?

Let's say we will not use distributed caching because we want that our microservices are independent and they do not have many single point of failures. Either we will have in-memory cache (simple ...
-2
votes
1answer
65 views

Do I need a redis for caching object while MongoDB already cached frequently accessed items

I'm using mongodb for our web application. Recently I'm think of adding redis for caching objects which usually is the setting/configuration. But the mongodb already cached the frequently accessed ...
1
vote
1answer
326 views

Pros and Cons of using ASPNET.Core In-Memory Caching instead of Redis? [closed]

I know redis is a very robust caching solution and scales great, but when it comes to simpler non-enterprise websites I feel as if it's a bit too expensive (Azure Standard/C1: $100/m). I'm ...
1
vote
0answers
40 views

How to specify constant data wrt cache coherence?

I am suspecting cache latency issues due to constant data (or same data across multiprocessor caches) being churned up in the cache coherence protocols. Is there a way to specify specific data as ...
3
votes
2answers
148 views

Preventive measures for stopping developers from forgetting to update cached values

I'm at the point where results need to be cached to make the application more responsive. From experience in a previous project, countless (to say the least) bugs occurred because there was lots of ...
2
votes
1answer
148 views

How is caching used within messaging apps?

I'm actually studying about web development. I was just asking why a lot of web apps and chats(Whatsapp, Telegram, Discord, and a lot, a lot more!) are using cache. I mean, after learning cache ...
0
votes
1answer
381 views

How to store counters on Redis while minimizing potential data loss

The application I'm working on has a need to create a counter representing the number of times each piece of content has been viewed. There are two goals here: Update the counter in real time ...
2
votes
3answers
1k views

How to align on both word size and cache lines in x86

From what it sounds like, a 64 bit processor means aligning to 64 bits, which means if you have unicode utf-8 stored in there, each 8-bit chunk would take up 64 bits of space. That doesn't really make ...
1
vote
3answers
60 views

Calculating Journey Summary made by a vehicle and Cache them to database

This is more of a point me in the right direction kind of question, I have 2 solutions but both of them are invalid because the data calculated is invalid in some scenarios. I am working on a system ...
0
votes
1answer
312 views

Cache vs DB design decision?

Number of times this question comes to my and my team mind, should we persist or cache the data. I understand some time there is functional requirement that we need to persist in DB. But in my case ...
2
votes
1answer
71 views

Data points to use cache or database for these three major features under scalable ecommerce? [closed]

Auto-completion :- When we start typing, does system suggest the product from cache or hit the DB every time or hit the DB only when no result found in cache ? Search:- When enter any product, does ...
-2
votes
1answer
144 views

Design for 'inbox' with 'unread' feature

I am implementing a similar feature like the StackExchange Inbox and I have many considerations about the resource usage. My system has inbox messages, system health notifications and Achievements. ...
1
vote
1answer
47 views

Managing cache when matching datas

I'm retrieving values from 3 tables in database and trying to make them match. I was wondering how I could manage cache in an elegant way. I can't change the database structure even though one of the ...
3
votes
1answer
2k views

Microservices - sharing data through distributed in-memory cache?

I'm fairly new to both microservices and shared in-memory databases like Redis. I'm wondering though if it would be a good idea to combine the two to address the challenges of data duplication, ...
3
votes
1answer
325 views

API design and storing custom queries from Db to cache

I was thinking about how people actually implement utilising results from a cache before a doing database lookup. When designing an API, should there always be a manual check to the cache first before ...
1
vote
1answer
73 views

How to go about accessing data on a server that has large downtime periods

Where I work, there is an Oracle data warehouse that is managed by another group that contains some pretty critical information for the company to run smoothly. The issue is that they (apparently, ...
0
votes
2answers
540 views

Preventing abuse of API which is called via client side Javascript

I'm setting up an AWS API Gateway + Lambda micro-service that will return non-sensitive but user-specific data.This means that the responses from the service can't be cached and served to multiple ...
-3
votes
1answer
223 views

Design the cache and search feature like hotel booking?

I need to design the feature like in encommerce(consider hotel booking site) we can enter the keyword/partial-keyword and need to return the relevant results. For Example :- If site admin or hotel ...
0
votes
1answer
49 views

What is the name for an object saving a cache of the result of operations as part of requests? [closed]

What is the conceptual term for a service that will respond to a request for a resource by: checking for its copy in a cache if it exists and isn't stale, returns it if it doesn't exist or is stale, ...
1
vote
3answers
77 views

Performance on highly filterable web pages

In our application we have a page were we list our entities with many options to filter and to search. Over time this page got slower and slower especially for large datasets, so we thought about how ...
2
votes
3answers
111 views

Web page: randomised collection of paged items retrieved via rest api call

Using .Net web api I have a web page that renders a collection of items depending on filter values applied via an ajax call to an api endpoint. The items are paged so that if the user scrolls to the ...
0
votes
1answer
834 views

Pattern for web service response caching, but only use the cache for when the data store goes down or request otherwise would fail

We have a REST web service written in C# in ASP.NET MVC/WebAPI. When the underlying data store fails, this can lead to our service being completely unavailable, instantly. There is currently no ...
0
votes
1answer
106 views

RESTful API get requests by “modified” condition from mobile app

Currently I have following scenario. I have two projects: ASP.NET Core Web API and Xamarin.Forms app. General idea is to have consumer (Xamarin.Forms app) which is getting data from server (Web API)....
1
vote
1answer
300 views

Caching data based on dependency-graph

My team and I are currently maintaining a caching system that is purely based on keys. From what I've read we are striving for a system that's based on the cache-aside strategy. Where we have a ...
2
votes
4answers
272 views

What to call data that's not ready yet?

I often see the term stale used to refer to data that is out of date, and fresh to describe data that is up to date. Both of those make sense to me. But what do you call data that is not yet fresh, ...
1
vote
0answers
165 views

Location specific caching for read-heavy data (server architecture)

This project will serve many duplicate requests with location-specific answers. I.e. 10,000 people in New York will all get the same server response (a list of businesses in New York), but one person ...
1
vote
1answer
100 views

Distributed BiPartite Graph [closed]

I have a use case where I have a Bi-Partite Graph. Call one type of nodes "Type A" and the other "Type B." Now when a Type A node gets added, it forms some edges based on a criterion with Type B nodes ...
2
votes
1answer
586 views

Is there a way to group keys when using Memcached?

I use Memcache to store content lists with very key combinations, when user edited the content, I must refresh the cache, but it is hard to say what particular list to refresh, it is not either a good ...
2
votes
2answers
2k views

Caching mechanism for REST APIs

I have been given a project recently where REST API have been implemented in the most basic way possible i.e. request comes to app, app hits controller, queries db, returns response. So this ...
1
vote
0answers
137 views

Cache sync across nodes in a cluster

I recently started working on a Spring web application, in which a cache for some heavily used data is stored in the JVM of each node in the AWS cluster. Any change in any of the node values results ...
0
votes
2answers
185 views

Web Service API Return Type

I'm trying to find some opinions on best practice for returning different types of data for the "same" endpoint. Surprisingly, I can't find much on this subject. Basically, I am building an API for ...
1
vote
1answer
698 views

How to handle caching and database management in microservices architecture?

I'm getting into microservices architecture and there are some issues which are badgering me. The main advantage of microservices is scalability. Let's say that I have service and I'm running 1-n ...
0
votes
4answers
198 views

How to implement “viewed: N times” functionality for an article?

How will I have to update "views_count" each time(!) a user loads my page? It will be costly. And I don't need such accuracy when I update "views_count" after a user loads a page. Then is there any ...
1
vote
2answers
1k views

Realtime statistics of last 60 seconds with O(1) time and memory [closed]

What would be a clean design for an app that is to store transactions and return a overview of the ones received in the last 60 seconds, operating in constant time and memory (O(1))? The app should ...
0
votes
2answers
86 views

Strategies for avoiding expensive batch searches

We have a list of about 100, 000 customers. Every night, we run a batch search of these customer names against a list of known criminals/suspicious persons. This list contains around 1 million entries....
5
votes
2answers
999 views

Using `304 Not Modified` and `If-Modified-Since` on a REST API as a cache strategy

I have the following scenario: a client app that consumes a REST API. The client is a mobile application. Therefore, it caches the API data for bandwidth saving and offline support. With REST it can ...
0
votes
1answer
132 views

Memoization in case of recursive interdefined functions in Haskell/Functional Programming?

I was reading Memoization with recursion which tells how for a recursively defined function fun we can do memoization by: -- Memoization memoize f = (map f [0 ..] !!) -- Base cases g f 0 = 0 g f 1 = ...
5
votes
4answers
687 views

Storing objects whose size are run-time dependent contiguously in memory

The background I am working on an ECS in C++ for fun and I am trying to make it as efficient as possible. One of the optimisations I am striving to implement is to minimise cache misses by storing ...
5
votes
3answers
6k views

Implementing a caching microservice by avoiding potential bottlenecks

The system I am working on employs quite a sophisticated caching/preloading mechanism for external third-parties, and since it is built on a microservice architecture, I would like to extract the ...
4
votes
1answer
295 views

Caching data in a Rails variable instead of querying the database?

I have a list of about 15000 items in my database, every one of them has a unique ID and name. New items are added regularly but usually not more than ten a day. My frontend uses a form with ...