Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [cache]

A cache is a component that transparently stores data so that future requests for that data can be served faster.

Filter by
Sorted by
Tagged with
1 vote
0 answers
107 views

How to reduce the build time/cache Docker image layer in subsequent GitHub Actions runs?

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. How to cache ...
shaik moeed's user avatar
5 votes
2 answers
2k views

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: ...
shaik moeed's user avatar
2 votes
2 answers
449 views

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 ...
Prolog's user avatar
  • 263
3 votes
1 answer
240 views

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. ...
random_letter's user avatar
1 vote
0 answers
141 views

Thread-safe key-value cache with expiration

I need my cache hold items to be accessible by key. The items should disappear after a configured time period. I do not need the lifetime of items to be exactly as configured. All I need is to make ...
C-F's user avatar
  • 111
0 votes
2 answers
512 views

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 ...
O. Jones's user avatar
  • 319
2 votes
2 answers
122 views

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 ...
Joshua Hyatt's user avatar
1 vote
0 answers
163 views

Caching tasks and removing them from the cache when faulted [closed]

Is the code in Test1 and Test similar if it's being called like in RunAsync? The example is simplified, but this is an application with a high concurrency during ...
Dirk Boer's user avatar
  • 650
0 votes
1 answer
97 views

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 ...
ParthS007's user avatar
  • 197
1 vote
1 answer
68 views

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 ...
finlay morrison's user avatar
3 votes
3 answers
321 views

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 ...
finlay morrison's user avatar
2 votes
2 answers
173 views

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? ...
DntFrgtDSemiCln's user avatar
3 votes
2 answers
231 views

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 ...
Dexter's user avatar
  • 415
0 votes
1 answer
148 views

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: ...
coderodde's user avatar
  • 28.5k
1 vote
1 answer
431 views

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 ...
filiphasan's user avatar
1 vote
2 answers
433 views

My LRU Cache implementation in Java

...
learner's user avatar
  • 21
2 votes
1 answer
185 views

Generic LRU Cache in Java

Problem I am creating a generic LRU Cache in Java. The LRU Cache should have \$\mathcal{O}(1)\$ set/get complexity. It is not expected to be thread safe. Feedback I would especially like your feedback ...
Adam McClenaghan's user avatar
1 vote
1 answer
110 views

Correct usage of Java Generics for a simple cache holding objects of any particular type that contain an identifier of any particular type

The Stack Overflow question, I'm trying to create an inMemory database using Collections and generics, presents some code that attempts to use Java Generics for an in-memory cache of objects of any ...
Basil Bourque's user avatar
1 vote
0 answers
431 views

Caching wrapper with multi-providers and factory to detect the responsible cache provider related to Type

What I'm trying to do abstract the caching actual cache provider (memory || distributed || ...). enable a caching diversity. each cached item type has different ...
Shrembo's user avatar
  • 151
1 vote
0 answers
642 views

Google Chrome Service Worker Persistent Storage Caching System

Moving from Google Chrome Extensions’ Manifest V2 to Manifest V3, service workers replace background pages. Background pages can be configured to be persistent, but service workers can’t be persistent....
clickbait's user avatar
  • 266
2 votes
1 answer
960 views

Implementing a Most Recently Used Cache

I want to create an In Memory Cache in .Net. The primary usage for this cache would be to store addresses... I want to keep around 1000 addresses in memory and once the cache is full, remove the Least ...
Hooman Bahreini's user avatar
2 votes
1 answer
201 views

Learning asynchronous caching by implementing one

After implementing a serial CLOCK second-chance cache in C++ without having enough rope to shoot myself in the foot, decided to dive into Javascript through NodeJs and write an asynchronous one. I ...
huseyin tugrul buyukisik's user avatar
2 votes
1 answer
124 views

Python: lru_cache make leetcode's dungeon game more slower

I'm trying to implement a recursive+momoize version for leetcode's dungeon game question. I tried to use @lru_cache(): ...
pvd's user avatar
  • 123
2 votes
0 answers
250 views

Simple implementation of various cache replacement policies

I am new to golang and I tried to implement various cache replacement algorithms (FIFO, FILO, LRU, MRU, LFU) in a generic or flexible fashion. I added some tests as well. My implementation uses the ...
Node.JS's user avatar
  • 389
2 votes
2 answers
3k views

Simple MemoryCache implementation for thread safe caching

After much prompting from this post I wanted to build a simple, in-memory, thread-safe cache. The only caveat (as far as I was originally concerned) was the need for two different absolute expiration ...
Matt W's user avatar
  • 157
0 votes
2 answers
2k views

Thread-safe LRU cache in Python

I've written a simple LRU cache class and I am trying to make it thread-safe. My thoughts are that I just need to wrap the code that updates the ordered dict in a lock so that if any thread is writing ...
sleepyowl's user avatar
4 votes
2 answers
59 views

Python persistant cache for non-pythonic objects

I am trying to implement a cache which can be persisted. Also, some of the functions that I am trying to cache takes arguments that are not python objects (external library objects). But they seem to ...
najeem's user avatar
  • 143
0 votes
1 answer
104 views

How do I divide Dao and Dao-Cache into different modules? [closed]

I want to improve performance for api. I design cache in dao layer. I use caffine cache. Basic code is: CacheConfig.java ...
study_20160808's user avatar
6 votes
2 answers
142 views

Another dynamic array implementation in C

I saw quite a few posts about making a dynamic array so I tried making my own for learning purposes. Here it is: ...
user avatar
3 votes
2 answers
685 views

An expirable LRU cache implementation

I implemented an ExpireLRUCache class, which will clear the data when it times out. There are two ways to achieve this: Use a timer to clear the expire data Call ...
daohu527's user avatar
  • 131
4 votes
1 answer
678 views

Efficient vector-like polymorphic container which retains type information

This is my attempt of implementing an efficient, cache-friendly, vector for polymorphic objects. From now on I will refer to "virtual functions" as functions which are dependent on an object'...
SomeProgrammer's user avatar
3 votes
2 answers
72 views

Caching that resets itself under certain circumstances: Reduce boiler plate code

In my machine learning programs I have the typical situation where I need to perform certain operations on data, which results in the following graph: data --op A--> intermediate_state --op B-->...
Make42's user avatar
  • 161
2 votes
1 answer
450 views

Thread-safe LFU Cache

I am trying to implement a thread-safe LFU cache algorithm, please review my code and would really appreciate some criticism or suggestion. (on naming, design, data structures used, anything) Some ...
yploo's user avatar
  • 31
1 vote
1 answer
2k views

Thread-safe LRU Cache Implementation in Java

I am trying to implement a thread-safe LRU cache algorithm, please review my code and would really appreciate some criticism or suggestion. Some assumptions: capacity will be larger than 0 Some ...
yploo's user avatar
  • 31
1 vote
0 answers
103 views

Metaprogamming elixir for module proxy

I'm working on my first real Elixir application, after dabbling for a few years. In my elixir/phoenix application I have to work with data over an external REST API. For my purposes, I can tolerate ...
Segfault's user avatar
  • 141
5 votes
1 answer
730 views

HSTS Recommendations in .htaccess

Please see my previous post in the below hyperlink I've updated my .htaccess file to account for an HSTS, along with many of the recommended changes. See the ...
user avatar
4 votes
1 answer
223 views

.htaccess Recommendations

I have a personal website that's used primarily for fun. I upload images, videos and text that I want to share. An HTML submission form accepts questions and string submissions from users, which uses ...
user avatar
4 votes
1 answer
2k views

TypeScript simple localStorage cache

I have a simple localStorage cache class written in TypeScript, would love to have some insights on any way/aspect you think it can be improved (making it more readable, maintainable, usable, etc.): <...
MauricioRobayo's user avatar
1 vote
1 answer
605 views

TypeScript fetch wrapper class with localStorage cache

I'm learning TypeScript while doing my portfolio, and I wrote a class to make a fetch request to the API that holds my data. It is working fine. I use localStorage to set a cache to avoid calling the ...
MauricioRobayo's user avatar
3 votes
1 answer
89 views

Update cache with minimal blocking

As part of the task, it is allowed to use slightly outdated data. It is required that only one thread per key is involved in the critical section, while the remaining threads use data from the cache ...
UserName's user avatar
  • 131
7 votes
1 answer
1k views

Decorator to cache a function result for some time

I recently played around with a script that got some data from the Google API. As I didn't want to spam requests at the service (and potentially get blocked), I made this decorator, which caches the ...
Graipher's user avatar
  • 41k
2 votes
0 answers
81 views

Parametrized cache simulation in C

This is an assignment known as a Cachelab from CMU 15-213. The full writeup for the lab can be found here, the handout I'm working against - here. All in all, the task is to emulate a cache, given the ...
Pavel Gurkov's user avatar
2 votes
1 answer
111 views

LRU Cache Example

Please check the following the LRU cache implementation. Thanks for the valuable comments ...
Neslihan Bozer's user avatar
2 votes
1 answer
80 views

Comparing two bash caches

I was working on making a cache in bash and I found this link - But this guy is attempting to generate new bash functions by introspecting their source and generating a new one as a cache. This seems ...
Christian Bongiorno's user avatar
1 vote
1 answer
142 views

Python-like decorators for caching

I am building an ad-hoc text-editor. I have two functions which use a cache, provideHover and provideCompletionItems. ...
nz_21's user avatar
  • 1,041
2 votes
2 answers
1k views

Simple c# MemoryCache mechanism to reduce number of db calls

I have some legacy code which gets a list of Students and their corresponding School. It's LinqToSql and there is no lazy ...
jonnarosey's user avatar
2 votes
0 answers
116 views

Loading weak cache in typescript

In Java, I use a LoadingCache which offers weakKeys and I need something similar in Typescript, so I wrote the following: ...
maaartinus's user avatar
  • 13.5k
4 votes
0 answers
141 views

downloading a list of urls

I wrote this quick (lots of googling) and dirty (I hope not too dirty) script to download a URL list with a win32 wget port and save them as files with the url as the name to use as a "poor man's url ...
beppe9000's user avatar
  • 191
8 votes
1 answer
2k views

Direct Mapped Cache simulation

This is my attempt to build a simple simulation of a direct mapped cache, I'm new to C and trying to learn some low level concepts. I had some difficulties with the design, because I'm used to program ...
din96b18's user avatar
2 votes
1 answer
293 views

PHP - using static variables to store "client" for later use

I had this S3Helper class before such that, every time I called a function to any of its methods (which I haven't shown here, but which do things like upload files to s3 or get temporary s3 links), it ...
TKoL's user avatar
  • 229

1
2 3 4 5 6