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
Filter by
Sorted by
Tagged with
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 ...
Theo's user avatar
  • 61
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 ...
shrewquest's user avatar
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 ...
beppe9000's user avatar
  • 191
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. ...
Peuge's user avatar
  • 141
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. ...
Alex Bar's user avatar
  • 273
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 ...
Tobias Gassmann's user avatar
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 ...
Matt W's user avatar
  • 157
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 ...
tigrou's user avatar
  • 421
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 ...
br3w5's user avatar
  • 255
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 ...
Jamie B's user avatar
  • 315
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 ...
Node.JS's user avatar
  • 389
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 ...
Pavel Gurkov's user avatar
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: ...
maaartinus's user avatar
  • 13.5k
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: ...
Catree's user avatar
  • 121
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. ...
user1941537's user avatar
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.: ...
Eugene Yarmash's user avatar
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, ...
w2olves's user avatar
  • 123
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: ...
kharandziuk's user avatar
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 ...
CharlesNRice's user avatar
  • 4,343
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/...
Mark Waterman's user avatar
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
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 ...
C-F's user avatar
  • 111
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 ...
Shrembo's user avatar
  • 151
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....
clickbait's user avatar
  • 266
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 ...
Segfault's user avatar
  • 141
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 ...
aydjay's user avatar
  • 663
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 ...
tamraj_kilvish's user avatar
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 ...
user1950349's user avatar