Questions tagged [cache]
A cache is a component that transparently stores data so that future requests for that data can be served faster.
275 questions
9votes
2answers
332views
Simple LRU cache implementations in C++20
LRU cache is a classical design pattern frequently questioned in programming technical interviews. It is best illustrated with pictures. Here are two examples. The following are two alternative ...
9votes
2answers
818views
Thread safe cache to sql call in c#
I'm unsure whether the following is thread safe. I want to say it is because the static state is only assigned to within the lock. However I'm more of a js programmer so this is out of my comfort ...
2votes
2answers
69views
LFU cache in Kotlin
I've been working on the classic LFU (Least Frequently Used) cache running in O(1) time problem lately and, as a student, I kind of struggled with the algorithms I found online. I got most of the idea ...
5votes
2answers
2kviews
How to reduce the build time of Docker image layer in GitHub Actions?
I have a Dockerfile with ubuntu:22.04 as a base image and a manual Python installation(specific version i.e., 3.11.1) layer which takes a long time. Approach 1: ...
2votes
2answers
505views
Thread safe accessing memory cache using semaphore
I have a Web API and for some requests we are sending requests to a third party API that requires request authentication. It's a simple bearer token, which I'd like to reuse across requests, because ...
3votes
1answer
258views
Expirable LRU cache
The requirements are: evict any expired items find the items with the lowest priority and evict the least recently used one Any feedback would be appreciated. ...
0votes
2answers
596views
Configuring SQLite3 for best efficiency as a persistent cache
I'm using SQLite3, via php's extension module, to create a persistent object cache for WordPress. It's intended for use on modestly sized sites that don't have access to redis or memcached. Why use ...
2votes
2answers
135views
Cache for mesh objects
I'm creating a cache system for an object (Mesh) that is expensive to create. A Mesh can be created using a small amount of ...
0votes
1answer
102views
Loading the file only once in application [closed]
I have json data in a file and I want to load the file content only once when application is initiated instead of calling the loading file multiple times in class instances. I created a config which ...
1vote
1answer
81views
Implementation of a multi-dimensional array as a single memory buffer [Part 2]
A couple days ago I posted my first implementation of my data structure here, which implements a cache-optimized tensor representation. I have worked the ideas from the responses into my ...
3votes
3answers
342views
Implementation of a multi-dimensional array as a single memory buffer
There is an updated version of this code with some of the recommended changes made here. I have created an implementation of a multi-dimensional array which utilizes a single continuous memory buffer ...
2votes
2answers
179views
Threadsafe LRU Cache
Trying to design a threadsafe lru cache using a reentrant lock. Currently I don't like the tryLock in a loop approach. Any inputs on making it more optimal in terms of concurrency? ...
3votes
2answers
238views
Thread-safe cached compiled Regex
I have a use case where I want to keep a pre-compiled regex, cached, for performance reasons, but the regex pattern also needs to be updated infrequently. Instances of CachedRegexFilter class will be ...
0votes
1answer
151views
LeetCode - LRU Cache by rodde
I have solved this LeetCode problem. Depending (perhaps) on the server load, I once scored the following performance figures: My code follows: ...
2votes
1answer
443views
Asp.Net Core CacheKey Management
I created cache management structure for Asp.Net Core and Redis. But i dont know is this best practices or bad. My Github Repo First one is Store my entity keys class is ...