A cache is a component that transparently stores data so that future requests for that data can be served faster.
0
votes
1answer
28 views
1
vote
0answers
24 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 ...
5
votes
2answers
53 views
Apostle Galaxies: dict subclass with disk caching
I am an astrophysicist working on large simulations as part of the APOSTLE project. The output of the simulations I use are large (TBs) and are stored in tables spread across multiple hdf5 files. ...
2
votes
0answers
30 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:
...
3
votes
2answers
107 views
Caching all the prepared statements in thread safe way
I have a below Singleton class where in my getStatement method, I populate a CHM by doing if check.
...
2
votes
0answers
63 views
Improving the flask cache decorator
In my rumblings developing flask applications I found the caching decorator. The decorator is a short and well-written piece of code, but I feel like it misses the few points bellow:
It only caches ...
4
votes
0answers
76 views
C# cache controller (Followup)
This is a followup to the question:
C# cache controller
Suggestions taken onboard from previous feedback, and refactoring to shorten the code in the calls to the cache controller by allowing queries ...
1
vote
2answers
118 views
Using Concurrent Dictionary and Lazy<T> to cache expensive query results and only run query once in a threadsafe manner
Ok, so I'm querying a webservice. This webservice is slow with multiple o's. I want to cache the results of the query, because I only want to query on a given set of parameters once during my ...
3
votes
1answer
72 views
C# cache controller
Problem
Currently my project utilises local caching wherever possible. There is a lot of similar looking code throughout that takes the form:
...
0
votes
1answer
31 views
Two (or more) LRU caches for a Node.js app
Here is a caching code of a nodejs / typescript app using lru Cache module from https://www.npmjs.com/package/lru-cache.
For various reason i need to setup separate caches: one for homeCache another ...
3
votes
1answer
80 views
Cookie wrapper made for fun
This was mostly made for fun, so I don't see it having any real world purpose any time soon.
...
2
votes
0answers
106 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 ...
3
votes
1answer
51 views
Managing Httpcache from C# using JSON configuration
I have written an efficient way to control data to be cached/not-cached in HttpCache using JSON and C# controlling it.
The reason for this implementation is to make use of existing application ...
1
vote
1answer
97 views
Cached repository implementation for small lists of data models
I have been using Repositories in my ASP.NET MVC projects and I felt the need to fully cache small tables data (dictionaries, cities, countries etc.). This kind of information is changed (very) ...
5
votes
3answers
163 views
Calculation caching experiment
There are a lot of numerical properties to be invoked many times with an expensive calculation. Let’s say for the sake of example, they expose a Factorial:
...
3
votes
0answers
113 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.
...
2
votes
1answer
154 views
1
vote
1answer
180 views
LRU cache in Python
Here is my simple code for LRU cache in Python 2.7. Appreciate if anyone could review for logic correctness and also potential performance improvements.
A confusion want to ask for advice is, I am ...
3
votes
1answer
88 views
Simulating memcache get and set race condition and solving it with add
Memcache get and set can hit a race condition if you use them together to achieve something like locking because it is not ...
4
votes
4answers
398 views
Property caching
Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one ...
5
votes
1answer
617 views
Caches implementation in C++
I had a test task for internship where the main part was in implementing fixed size caches with different displacement policies (LRU/LFU/FIFO). I did that task, but was refused afterwards. Now I am ...
3
votes
0answers
183 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/...
0
votes
0answers
28 views
Prefetch in ARMv7
I have to implement Khatri Rao product between 2 matrices in C. Mathematically this is a column major access of data and I can not change that. But if I use preload ( PLD instruction in ARMv7 ) to ...
2
votes
1answer
119 views
Create a cache object in javascript
My intent is to use this object to cache data from web responses. The cache object should only be valid for the current data.
...
0
votes
1answer
37 views
Get properties from all children in a recursive SQL structure
In our product, Company is a model that can have many Companies belonging to it; so some Companies are parents, some are children, and many are both.
We have a ...
1
vote
0answers
48 views
Caching calculation results in R
Here is what I came to for calculation result caching/invalidating. What do you think?
How to use:
...
2
votes
1answer
578 views
Script that retrieves trending topics from Twitter
The following code fetches trending topics from Twitter's API using a WOEID. It caches the response, loading from this cache the next time if its relatively fresh (generated within the last 15 minutes)...
4
votes
2answers
279 views
Simple Timed Cache by Wrapping HashMap
Just wanted to get a bit of feedback on this simple cache. My use case is to store this data on an Android client to avoid making a high volume of network calls for lookups.
I feel like maybe I ...
6
votes
1answer
93 views
Can my cache be more thread safe?
I have been working on a cache that can handle multiple reads at the same time, but the write is blocking.
Is this code overkill by using both a ConcurrentHashMap ...
2
votes
1answer
116 views
Singleton implementation of Cache Dependency Manager
I am trying to implement a singleton CacheDependencyManager, by combining this CacheDependencyManager from Steve Greatrex with a singleton pattern from Jon Skeet (example 6).
I'd really appreciate ...
2
votes
1answer
96 views
An asynchronous service to produce a results cache for a list of items
What I've created is a CacheBuilder service that will be passed in a list of items, and will build a results cache. The results are produced by making calls to ...
4
votes
1answer
224 views
LRU caching decorator that caches in the instance and in a shared cache
I needed a caching decorator, that could be used with methods and functions, that could take typed args and kwargs, and that was Python 2.7 compatible. Therefore I started with a backport of the <...
1
vote
0answers
46 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 ...
4
votes
1answer
2k views
Caching image in memory or on disk
I am caching an image locally..That same image will be used in few screens. Steps for doing this is as follows:
Get image from cache
If not present in NSCache, get image from Cache directory
If not ...
4
votes
1answer
60 views
Caching mechanism for saving a bitmap
I needed a quick caching mechanism to save a bitmap (picture). There was no way I could get the bitmap to the class where I need to upload it to the server so for the sake of organization and code ...
4
votes
0answers
380 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 ...
6
votes
0answers
104 views
2
votes
1answer
49 views
Using Cache::remember for banners and stores
I'm using Cache::remember to cache 3 results in my action, 2 in the same call to Cache::remember. It works, but I have 2 ...
3
votes
0answers
78 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
1answer
123 views
Generic ObjectCache with Expiration
I sometimes need an object that caches some data but only for the specified amount of time. So I created a class that should handle this. The main goal was to make it generic unlike the ...
3
votes
1answer
41 views
3
votes
0answers
148 views
Cache with timeout per key
I wrote a general purpose library for in-memory cache with custom timeout for each key.
...
2
votes
1answer
60 views
Java basic AsyncCache implementation
I wanted to use an async-cache to store URLs of images that I have to display in a list. The image URL is fetched (REST call) using a unique UUID associated with each item of the list. I store this ...
4
votes
1answer
204 views
LRU Cache in ECMAScript
I wrote this for a CodeWars challenge while trying to learn ECMAScript and would really like to have some advice on how it could be improved.
What I don't like about this code myself, but am unsure ...
4
votes
1answer
216 views
Properties File MRU Cache
I made an attempt to implement a Properties File MRU Cache with a limited cache size which are of the most recently used properties can only be held in. A read miss from this cache leads to a read ...
5
votes
2answers
379 views
Caching large object in multithreading environment
I'm having to dabble with caching and multithreading (thread per request), and I am an absolute beginner in that area, so any help would be appreciated.
My project requirements are:
Cache one single ...
1
vote
0answers
40 views
Deciding when to update an image in the database
I have written a method which is used to determine whether or not I need to update an image stored in a database with an image stored on a local machine. The criteria for when an image needs to be ...
1
vote
1answer
166 views
Implementation of self-updating, asynchronous cache solution of individual (non-bulk) objects
Here I am again; referring to my previous code review request about a self-updating, asynchronous (?) cache.
The previous class takes care of caching operations like "get all users registered in our ...
0
votes
2answers
215 views
Implementation of asynchronous (?), self-refreshing cache of object collection bulk
I'm trying to create a caching solution used in various parts of a clients' application. The resulting code will be open source.
For example, it will be used for caching API queries like "get all ...
2
votes
1answer
945 views
LRU cache design using dict and doubly linked list
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive) of the ...