Questions tagged [cache]
A cache is a component that transparently stores data so that future requests for that data can be served faster.
28
questions with no upvoted or accepted answers
6
votes
0
answers
213
views
Resource cache based on Stroustrup 22.2.4
I recently read "The C++ programming language" chapter 22 and I thought the example given in chapter 22.2.4 was quite interesting. I thought it should be possible to make this system caching, so it ...
6
votes
0
answers
2k
views
Implement two level caching using spring's cache abstraction Cache and CacheManager
Details about spring's caching framework are here. When I was reading this link, I thought the composite cache mentioned there was one that used levels of caching based on the order given to the ...
4
votes
0
answers
140
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 ...
4
votes
0
answers
439
views
2-tier c# cache
I have slightly altered Marc Gravells 2-tier cache code which can be seen here. I changed it to use Stackexchange.Redis instead of Booksleeve and also added some retry logic and serialization.
...
4
votes
0
answers
348
views
Cache with timeout per key
I wrote a general purpose library for in-memory cache with custom timeout for each key.
...
3
votes
0
answers
60
views
Caching different http-requests
There have been multiple discussions on caching http-requests with RXJS. In this question/proposal I want to propose a custom rxjs-operator (non-pure) to provide ...
3
votes
0
answers
552
views
Iteration of self-refreshing MemoryCache encapsulation
I have attempted to implement the advice from the original post and debugged the original concept.
Certain changes in the logic have necessitated other changes, including breaking into the library ...
3
votes
0
answers
1k
views
Create PDF preview
I have written the following GetPDFPreview() method. It open a PDF file, create a thumbnail (using PdfDocument class) and ...
3
votes
0
answers
133
views
Angular OOP services and caching
I've created a caching service using OOP techniques combined with the revealing module pattern and the angular-cache library. New CacheDataClass objects are ...
3
votes
0
answers
570
views
Rails app that scrapes forum using Nokogiri gem
I've built a website that scrapes a guitar forum's pages and populates Rails model. I'm using rake task along with heroku scheduler to run background scrapes every hour.
On the homepage, the forum ads ...
2
votes
0
answers
247
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 ...
2
votes
0
answers
80
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 ...
2
votes
0
answers
115
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:
...
2
votes
0
answers
2k
views
Fast matrix transpose
I would like to improve the naive matrix transpose algorithm by using a cache friendly algorithm.
So far there are 4 variants.
Iterate over the source matrix:
...
2
votes
0
answers
1k
views
localStorage should expire after 24 hours
The following code is checking if the user's browser is IE and if this is the case and there's no localStorage yet, it sets a localStorage, which should be valid for only 24 hours.
...
2
votes
0
answers
254
views
Implementing key map with expire and size limit
Recently I have been asked to implement a key map with expire time for each key and possibility to limit the number of keys, in Python. I've used a dictionary + heap to store the entries, e.g.:
...
2
votes
0
answers
113
views
Fetch object from database, or fetch it using an API if it isn't there
To give some background on this particular code, there is a controller which recieves an object, hashes parts of it and looks into a database to see if there is a similar hash in the db, if there is, ...
2
votes
0
answers
66
views
Cache for slow API
I work with an API which answers really slowly. I created a module which constantly asks the API and update some cached value. The code is degraded for study purposes:
...
2
votes
0
answers
1k
views
Caching using MS Unity Interception
I wanted to cache methods using unity interception and not have the parameters passed in stay alive for the sake of caching. If the objects would have gone out of scope without caching then the cache ...
2
votes
0
answers
1k
views
Thread-safe LRU cache for C++
I'm working on a simple LRU cache for C++. There's nothing spectacular or unusual about it, but I would like it to be thread safe.
(I'm going to be using this for instructional/benchmarking/...
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 ...
1
vote
0
answers
130
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 ...
1
vote
0
answers
414
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 ...
1
vote
0
answers
633
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....
1
vote
0
answers
102
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 ...
1
vote
0
answers
86
views
Bookmark controller with IMemoryCache
I'm just doing a small hobby project to solve a little problem I have and I'm using it as a learning exercise for ASP.Net MVC 5, .Net Core 2 and Bootstrap.
I'm using a nuget package that handles ...
1
vote
0
answers
1k
views
A simple thread safe LRU cache using unordered map and lists in C++
I am learning concurrent programming and am writing a thread safe LRU cache for practice. Below is my first attempt. Kindly comment and let me know where I can improve.
PS: There have already been a ...
1
vote
0
answers
1k
views
Purging elements from the map if it reaches a memory size limit
I have implemented a LRU cache using ConcurrentLinkedHashMap. In the same map, I am purging events if my map reaches a particular limit as shown below.
I have a ...