Is it OK to use HttpRuntime.Cache outside ASP.NET applications?

I realize this question is old, but in the interest of helping anyone who finds this via search, its worth noting that .net v4 includes a new general purpose cache for this type of scenario. It’s in the System.Runtime.Caching namespace: The static reference to the default cache instance is: MemoryCache.Default

Does it make sense to have max-age and s-maxage in the Cache-Control HTTP header?

From HTTP Header Field Definitions: 14.9.3 Modifications of the Basic Expiration Mechanism … s-maxage If a response includes an s-maxage directive, then for a shared cache (but not for a private cache), the maximum age specified by this directive overrides the maximum age specified by either the max-age directive or the Expires header. … Note, … Read more

How to cache Django Rest Framework API calls?

Ok, so, in order to use caching for your queryset: class ProductListAPIView(generics.ListAPIView): def get_queryset(self): return get_myobj() serializer_class = ProductSerializer You’d probably want to set a timeout on the cache set though (like 60 seconds): cache.set(cache_key, result, 60) If you want to cache the whole view: from django.utils.decorators import method_decorator from django.views.decorators.cache import cache_page class ProductListAPIView(generics.ListAPIView): … Read more

How to limit the maximum size of a Map by removing oldest entries when limit reached [closed]

You can use LinkedHashMap like this You can remove by LRU or FIFO. public static <K, V> Map<K, V> createLRUMap(final int maxEntries) { return new LinkedHashMap<K, V>(maxEntries*10/7, 0.7f, true) { @Override protected boolean removeEldestEntry(Map.Entry<K, V> eldest) { return size() > maxEntries; } }; }

Which .NET Memcached client do you use, EnyimMemcached vs. BeITMemcached? [closed]

We tested both and found Enyim to perform the best for our expected usage scenario: many (but not millions) cached objects, and millions of cache-get requests (average web site concurrency load = 16-20 requests.) Our performance factor was measuring the time from making the request to having the object initialized in memory on the calling … Read more