A cache is a component that transparently stores data so that future requests for that data can be served faster.
1
vote
1answer
59 views
How to correctly use lock when adding/renewing cached data in asp.net cache?
This is sort of a follow up question on http://stackoverflow.com/questions/754661/httpruntime-cache-best-practices/11431198 where a reply from frankadelic contains this quote and code sample from ...
0
votes
0answers
69 views
caching in WCF web service
I want to realize caching in WCF web service. I'm using the following code:
public interface ICache<T> : IDisposable where T : class
{
string Name { get; }
CacheItemPolicy ...
1
vote
3answers
69 views
Caching a JS selector then only using it once
I have this code:
var submit = document.getElementById('submit');
var error = document.getElementById('error');
var url;
submit.onclick = function(){
url = document.getElementById('url').value;
...
4
votes
3answers
182 views
Code Review for generic cached IEnumerable<T>
I've an IEnumerable source which takes time to generate each item. Once an item is generated I want to cache it to avoid recomputing same. I want to separate out caching logic from original source. ...
1
vote
1answer
137 views
Thread safe cache implementation
Please review this implementation of thread-safe chache.
public class StaticCacheImpl<T extends Entity> implements StaticCache<T>
{
private boolean set = false;
private ...
0
votes
2answers
150 views
Improvements and advice for my Cache class
After reading a bit about the System.Runtime.Caching in the .net 4 framework I've added a simple Cache class to my application.
Can I improve it or add additional useful functionality? Typing it out ...
2
votes
2answers
146 views
C# small caching API
public interface ICacheable<TK,TV>
{
TV Get(TK key);
void Add(TK key, TV val);
}
public abstract class BaseCache<TK, TV>
{
protected static Dictionary<Guid, Dictionary<TK, ...
9
votes
2answers
221 views
Lock-free cache oblivious n-body algorithm
I'm currently looking at, from a rather high level, the parallelization of the gravity calculation in an N-body simulation for approximating a solution to the N-body problem.
The simple form of the ...
2
votes
3answers
157 views
Public property, backing up by a private field, with caching and null checking inside
I have a private field called individualProfile (camelCase) and I've created a public property called IndividualProfile (PascalCase) on it:
private Profile individualProfile;
public Profile ...
2
votes
1answer
90 views
Does this function cache correctly?
I want to limit the load so I rewrite the most expensive method and add caching, both memcache and cache-control:
class GeoRSS(webapp.RequestHandler):
def get(self):
start = ...
2
votes
1answer
578 views
An LRU cache template
I recently implemented a cache for a pet project of mine. The main objectives behind this implementation were:
Support move-only types for values: C++11 is here, and some of the objects that will be ...
0
votes
1answer
115 views
Iteration and memcache for selected categorized random elements?
The following code is a quick implementation since I only needed 3 random images sorted by category (a random eyes image, a random nose image and a random mouth image and then combine them)
...
2
votes
3answers
403 views
C++ Static Class member destruction
I have a basic cache set up where whenever a user requests a bitmap it fetches it or loads it from disk if it isn't already loaded, significantly reducing load times. Currently the design explicitly ...
2
votes
1answer
206 views
Possible solutions to remove the use of a Hashtable
While this is working very well for storing setting variables for my applications, I've been using it for a number of years and really feel there is something better. I'm perhaps just looking to use ...
4
votes
1answer
550 views
LinkedHashMap as LRU cache
I have a simple implementation for a LRU cache using LinkedHashMap.
I want it to be as generic as possible.
This is not for production use, just practice, so I don't care
if its thoroughly ...