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

learn more… | top users | synonyms

10
votes
4answers
269 views

Ugly optimized caching of SimpleDateFormat

Concerning the optimization of this simple function String formatDate(String format, Locale locale, Date date) {...} formatting a ...
2
votes
0answers
37 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 ...
-1
votes
0answers
68 views

Thread-safe, in-memory LRU cache with a max item count of 10 - follow-up

The following code is the revised/feedback version of my previous post. The big change was converting RicCache class object to an instantiated object. I'm ...
3
votes
2answers
66 views

Thread-safe, in-memory LRU cache with a maximum item count of 10

I'm attempting to master LRU Caching. It must be thread safe, and it should preferably perform as well as web image-cache, (avg ~1MB). Please take a look to see if there's anything wrong, amiss, ...
2
votes
2answers
58 views

Database mirroring cache

I generally prefer to work with EF by specifying exactly the data to fetch from the DB with regards to Navigation Properties/Lookups and the like, so we wrote this cache system to limit the number of ...
3
votes
1answer
36 views

Using EHCache the right way

I use EHCache to maintain a mostly read-only cache of results from database queries. It works perfectly for over a dozen queries. However, there is one table which needs an odd access method that is ...
4
votes
2answers
78 views

Simple LRU cache with an expiration time

How can I improve the performance of the code below? ...
4
votes
1answer
56 views

Python caching generator

Is this the correct way to cache a generator in Python, without iterating over it right away (for example using list() over it)? ...
3
votes
2answers
59 views

azure cache getoradd (without locking)

Inspired by the non-locking implementation proposed in this thread: Locking during cache population , the following code is an attempt to (about) do the same using the azure cache. As I'm totally ...
12
votes
4answers
217 views

I'm not sure if I still love Fibonacci, but my code is getting better. How much better?

Technically, this is a follow up to these two questions, but I have taken a radically different approach. Everybody Loves Fibonacci Does everyone still love Fibonacci I finally allowed myself to ...
1
vote
0answers
98 views

HttpRuntime.Cache cache manager class

I am making code review of legacy class, which manages caching logic. Caching logic uses ASP.NET webforms HttpRuntime.Cache. I know class, that is posted below, is ...
4
votes
2answers
280 views

Creating a cache manager

I am purely new to C++ memory management. Am I on the right path, or should I employ a different design strategy or a different memory manager policy (such as ...
2
votes
1answer
71 views

Is my ObjectCache wrapper sound?

Wrapper: ...
1
vote
1answer
55 views

Using Redis to store word occurences

I am doing a project where I am analyzing a group of Tweets. What I need to do is find the occurrence of each individual word. I am fairly new to Redis, so I am not quite sure that my solution is ...
4
votes
1answer
110 views

Using the Rotten Tomatoes API

This is a Python module I made to search the Rotten Tomatoes movie API. It caches the search results in a SQLite database. What improvements can I make to the cache system? Is there a better way ...
4
votes
2answers
183 views

ASP.NET MVC architecture questions

I haven't done much .NET development in several years. Now I'm enjoying some of the new stuff with modern .NET. I just want to make sure I'm using things correctly. I'm a solo developer with no one ...
2
votes
1answer
829 views

Generic, thread-safe MemoryCache manager for C#

Using this question as a base, and using some of the advice in the answers, I wanted to build out something that would be generic, thread-safe, and easy to use for at least one current and several ...
2
votes
2answers
63 views

JavaScript bookmarklet with a 24 hour cache

I'm working on a bookmarklet that will be cached for 24 hours only, after that time it will be reloaded from the original source. Is there something I could improve? ...
5
votes
1answer
111 views

HTTPCache and MemoryCache cross dependency

After asking a question on StackOverflow about the two .NET caching systems taking dependencies on each other I gave implementing them a go. I posted them as my own answer there but before accepting ...
15
votes
7answers
2k views

Why does caching of string objects perform faster?

I'm trying to implement String-Pool. I'm maintaining a HashMap<String,String> to store the keys. ...
2
votes
1answer
72 views

LRU Cache with a static variable for garbage value

I have tried to implement a Least Recently Used cache with only C++ STL containers. The main thing that I keep asking my self the static variable called ...
10
votes
1answer
182 views

Allowing user space file-system to (kind-of) keep more than maximum number of files open

The linked code below is meant to be used in a user space file-system (fuse). Given that multiple processes may have multiple files opened on the file-system, the files on the specific user space ...
3
votes
2answers
531 views

Generic MemoryCache class

I want to have a caching class to cache different types. I want each type to be cached in a different MemoryCache but in a generic way. Am I doing it right? ...
1
vote
1answer
189 views

Performance issue of LFU-like web caching replacement algorithm

I have implemented a simulation program that runs LRU and another web caching algorithm called Sliding Window LFU. I want to compare them both in terms of the hit rate and their run time. SW-LFU works ...
1
vote
1answer
25 views

Loading Recent Posts In Session? [closed]

I have a PHP code structure where I cash some pages in sessions. Example: I have a page which shows last 10 user posts, what I do is to load 10 posts and store then in session: Page Class: ...
3
votes
2answers
237 views

In-memory cache implementation revisited

As a follow-up on my earlier question, here is the new implementation. The major change is now that the base class just deals in ICacheValue values which are ...
3
votes
1answer
92 views

htaccess for URL remapping, caching, and compression

I have been collecting snippets from all over the place and then put them all together creating the following .htaccess file. I really don't understand if what I have done below is good/should work ...
0
votes
0answers
55 views

Adding viewstate based property and implication in future converstion to MVC in ASP.NET forms project

Supposedly adding another viewstate based property in user control (riddled with similar properties) incur technical debt in future effort to convert projects to MVC (comment made by one of my ...
8
votes
1answer
217 views

Cache wrapper - Generics vs Dynamic

I've implemented a common wrapper pattern I've seen for the .NET cache class using generics as follows: ...
5
votes
3answers
122 views

Class with a temporary buffer: Tradeoff between memory usage and execution speed [closed]

Consider the following two classes class foo{ // huge data structure - 400-500 bytes per instance }; class Bar{ void get_foo(int n, foo& f); } In my ...
7
votes
1answer
2k views

In-memory cache implementation

A few years ago I required a lightweight in-app-in-memory cache. Requirements: Time complexity O(1) for individual element read/write access Space complexity ...
4
votes
1answer
222 views

Function to delete oldest items out of HTML5 localStorage. Can I make it more efficient?

In a current javascript project, I'm working with the browsers localStorage, and it will pretty consistently be full. To overcome this, I wrote a wrapper to surround the localStorage object that would ...
5
votes
1answer
92 views

Optimize text to ascii lookup map and scalability

Is there a more optimal way of retrieving the character for the letter? I would assume that I would just replace my Entry set loop with another map, but I do not want to bloat the code, because it ...
4
votes
1answer
119 views

Caching a function view for a day

I am writing a flask app that I will deploy it on Heroku to test it. There is a page that will generate daily photos and information based on a JSON file. The view is valid for 24 hours beginning from ...
4
votes
1answer
218 views

In-memory data cache architecture for data transfer

I am writing a cron job to manipulate and transfer remote data. I need to cache data from a table, process it, merge with previous table, iterate the process, and eventually send the result data to ...
3
votes
1answer
119 views

How to improve this session cache to search faster

I have this code which will store user session credentials: ...
5
votes
1answer
827 views

A Simple Cache class

“There are only two hard things in Computer Science: cache invalidation and naming things.” -- Phil Karlton That being said, I created this SimpleCache class which I intend to use to cache ...
1
vote
0answers
113 views

In-memory data cache architecture

I am designing a basic in-memory cache storage with a thin CRUD (actually CRD) interface. The design is inspired by backend solutions such as Parse and StackMob. Main characteristics: Cache ...
5
votes
1answer
270 views

Generic pure functions memoization

I like to create tools for memoization since it can sometimes be useful. I recently created a generic tool for memoizing pure functions results. Here is an example of how it works: ...
6
votes
1answer
110 views

Optimize RecursionArray interface

I created a class a while ago that I named a "Recursion Array". It is a way to create dynamically memoized sequences such as the Fibonacci sequence or the factorial numbers sequences. The concept is ...
1
vote
0answers
146 views

Improve the architecture to cache data

I cache the data and use local database in my Windows Phone app. Algorithm is very simple: Get data from DB and show in UI Get data from a web service and show in UI Update data in DB from the web ...
2
votes
1answer
2k views

Design LRU cache interview questions

Code reviewers, I request you review the code and suggest all tips for improvement. ...
4
votes
1answer
687 views

Locking during cache population

Here I want to lock when populating a particular cache object, without blocking other calls to the same method requesting Foos for other ...
1
vote
0answers
162 views

Combine and minimize all .js files in parent folder

I'd appreciate some feedback on my latest PHP script. It is supposed to work like this: When obtained, it checks whether the cache is still up-to-date IF YES, return the cache; IF NOT, reset the ...
3
votes
2answers
154 views

Perl script for generating iTunes xml Metadata for MP3 CDs/DVDs

Many years ago, I wrote a script in Perl that was meant to create a cached metadata of MP3 files (in Apple's plist/XML format) which iTunes uses when you insert a CD/DVD full of MP3 files (the same ...
1
vote
0answers
116 views

Memcached caching

I wanted to create a class to cache dynamic PHP output (or a portion of it from one page) using Memcached key/value story. Basically it checks to see if the file has been cached already, if it has, it ...
1
vote
1answer
111 views

Cache mechanism with duration

I want to implement in my code a cache mechanism with a fixed duration. For example an iframe will be cached for one hour, or a script file will be cached for 24 hours. This is how I implemented it, ...
2
votes
1answer
408 views

How to create a simple stateless cache class in PHP

i need to create a cache class to avoid making the same calculations more than needed. My idea was something really basic like ...
4
votes
1answer
564 views

Implementing cache for server. Any suggestions?

I've just implemented a cache for my server, and I'd like your thoughts about performance improvements and maybe some possible bug fixes: ...
1
vote
1answer
174 views

Simple cache mechanism?

In my system I frequently require data by Ajax requests. For example, different lists, content of modal dialogs, etc. This data can't be changed after request, so I wrote cache mechanism which stores ...