A cache is a component that transparently stores data so that future requests for that data can be served faster.
3
votes
1answer
63 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 ...
3
votes
4answers
206 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
112 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
63 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
25 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
36 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
33 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
41 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
113 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
68 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
80 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
80 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
53 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
84 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
35 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 ...
3
votes
0answers
458 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
57 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
237 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
81 views
2
votes
1answer
43 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
60 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
86 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 ...
2
votes
1answer
30 views
3
votes
0answers
104 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
56 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
106 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 ...
3
votes
1answer
139 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
233 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 ...
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
91 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
127 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
462 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 ...
3
votes
1answer
106 views
Class for returning a different value every so often
I have a class that I'm trying to determine a good name for. I don't know if this concept comes up a lot in programming or not, but I'm wondering if I can get some suggestions for a good name for the ...
4
votes
1answer
53 views
Storing get call data on same function
I basically have a folder view structure, that each time I call grabs the value of the selected field and gets that specific folder data. I was wondering if there's a better way to do this by caching ...
5
votes
5answers
1k views
10
votes
2answers
521 views
Memory cache implementation
I have created an open source memory cache called cachew and can be found here:
cachew. I would like your help to make it better.
Regarding the class Cache or its ...
2
votes
2answers
950 views
Object-cache C# Take two
I have previously attempted to write a object-cache that I use in co-junction with Redis keeping a persistent data-model. Old post can be read here Cached-object Store c# with Redis client for ...
2
votes
1answer
3k views
Cached-object Store c# with Redis client for persistent storage
I have written a Cached-Object store with a Redis Client for persistent storage. The application that is going to use this is a heavy read application with the occasional write. I assume that entire ...
7
votes
2answers
254 views
Thread-safe memoizer
I have searched around but I was not able to find a complete implementation of the memoize pattern in a multithreaded context. It's the first time playing with thread synchronization. The code seems ...
4
votes
2answers
395 views
Resource caching in Java with soft references
I'd like to cache some heavy resources locally. The goal of this implementation is to have be able to load resources for an unknown amount of time and then keep them in memory and finally evict them ...
2
votes
1answer
48 views
Simple BloomFilter Class
We have some BloomFilters (like a java.util.set without deletion) and we store them in ehcache (you can think it's as a ...
3
votes
1answer
2k views
Spring oauth2 token store supported by redis
I had to make a demo for Spring oauth2 with redis store for tokens. I started with the sparklr2 (with tonr2) sample app from here. They are demo apps to show oauth2 powered by spring. Sparklr is the ...
2
votes
1answer
143 views
Thread safe double buffered cache
I want cache object for one value, which have two expiration limits.
One "soft" limit indicating "value is old, but is still valid, but is good time for reload the value". And one "hard" limit ...
1
vote
2answers
731 views
Caching using phpFastCache
I have a class that holds functions for caching using PHPFastCache. There are quite a few static functions in here and for each one I am declaring:
...
3
votes
1answer
558 views
Simple thread-safe loading cache based on RxJava
I'm sketching a simple thread-safe cache which can load missing values. It is based on RxJava's Observable which also means that it should be possible for a client to join a request for value which is ...
4
votes
3answers
184 views
Thread safe cache for write through and writeback
This cache is like a list where new elements are inserted in the middle, cache hits are put to head of the list and replaced elements are taken from the end. Would I just use a list the lookup would ...
3
votes
1answer
2k views
Redis Cache Data source code - Retrieve/Set/Invalidate actions
This is my RedisDataSource code. What I am mainly interested in is how the retry policy could be improved and if using WindowsAzure Trainsient Fault Handling this case (using Redis Azure Cache) makes ...
1
vote
1answer
84 views
Caching DOM-queries
I've been optimizing my code and I always tend to cache common selectors like this (jQ):
...
3
votes
1answer
153 views
Reducing lock contention for a caching utility, or make it totally lockless but threadsafe
My Java program is a module called configProxy which fetches configuration entries from a remote node (say from a Redis instance). When the caller calls the ...
10
votes
2answers
135 views
Inspector Rubberduck - Take Two
Release 1.1 of Rubberduck only had a handful of implemented code inspections, more as a proof of concept than anything else. For release 1.2, we now have 19 implementations of our ...