Is MemoryCache scope session or application wide?

From MSDN: The main differences between the Cache and MemoryCache classes are that the MemoryCache class has been changed to make it usable by .NET Framework applications that are not ASP.NET applications. For example, the MemoryCache class has no dependencies on the System.Web assembly. Another difference is that you can create multiple instances of the … Read more

Caching query results in django

Pop your cached query into Django’s cache: from django.core.cache import cache cache.set(‘key’, queryset) Then create a context processor to add the value of the cache to all templates: # myproject/myapp/context_processors.py from django.core.cache import cache def cached_queries(): return {‘cache’, cache.get(‘key’)} Then add your context processor in your Django settings file: TEMPLATE_CONTEXT_PROCESSORS += ( ‘myproject.myapp.context_processors.cached_queries’ ) Now … Read more

How to force DNS refresh for a website?

As far as I know, a forced update like this is not directly possible. You might be able to reduce the DNS downtime by reducing the TTL (Time-To-Live) value of the entries before changing them, if your name server service provider allows that. Here’s a guide for less painful DNS changes. A fair warning, though … Read more

Expire a view-cache in Django?

This solution works for django versions before 1.7 Here’s a solution I wrote to do just what you’re talking about on some of my own projects: def expire_view_cache(view_name, args=[], namespace=None, key_prefix=None): “”” This function allows you to invalidate any view-level cache. view_name: view function you wish to invalidate or it’s named url pattern args: any … Read more

How long does Google Chrome cache a resource if expires and/or no-cache headers are not set?

The time the browser considers a cached response fresh is usually relative to when it was last modified: Since origin servers do not always provide explicit expiration times, a cache MAY assign a heuristic expiration time when an explicit time is not specified, employing algorithms that use other header field values (such as the Last-Modified … Read more