Questions tagged [django-caching]

django-caching refers to the Django cache system

django-caching refers to the Django cache system.

Quote from docs:

Django comes with a robust cache system that lets you save dynamic pages so they don’t have to be calculated for each request. For convenience, Django offers different levels of cache granularity: You can cache the output of specific views, you can cache only the pieces that are difficult to produce, or you can cache your entire site.

57 questions
1
vote
1 answer

Django's query result caching

I am creating a website using Django 1.7 and GeoDjango. I've hit the point when i need to optimize website speed. One of the bottlenecks is query execution. There are some queries which run slowly even when optimized. So i'd like to cache query…
Termos
  • 664
  • 1
  • 7
  • 31
1
vote
1 answer

Django Caching with Users

I was wondering if there is a way to cache querysets to memcache on a site that has authenticated users and users that are not authenticated. Basically I just need to cache queries from one table. Any ideas would be great. Thanks
icebox3d
  • 449
  • 7
  • 17
1
vote
3 answers

Remove all matching keys from Django cache

I need to iterate through my server's cache, which is a LocMemCache object, and remove every key in the cache that begins with the string 'rl:'. From what I understand, the only functions that the caching API django provides are get, set, and…
user3692392
1
vote
2 answers

Django admin cache m2m relation

I have two models: models.py class City(models.Model): title = models.CharField(max_length=255) show = models.BooleanField(default=True) class Company(models.Model) title = models.CharField(max_length=255) cities =…
1
vote
0 answers

Getting caching working with Django

We are trying to implement caching in Django. We have tried memcache, file system caching and local memory caching. No mater what it just isn't working -- a timestamp we put on the template to test caching is always updating so we know it's not…
user1328021
  • 9,110
  • 14
  • 47
  • 78
1
vote
1 answer

Django Cache Implementation

Well, I'm designing a web application using Django. The application allow users to select a photo from the computer system and keep populating onto the users timeline. The timeline view have a list/grid of all the photos which the user has uploaded…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
1
vote
2 answers

Django Cache + Django Database request

I'm building a Django web application which allow users to select a photo from the computer system and keep populating onto the users timeline. The timeline will be showing 10 photos initially and then have a pull to refresh to fetch the next 10…
Praful Bagai
  • 16,684
  • 50
  • 136
  • 267
1
vote
1 answer

Google Maps Ground Overlay not caching Django served dynamic image

I've set up a google maps overlay (v 3.10) in javascript to display an image generated on the server: var overlay = new google.maps.GroundOverlay(url, MAP_BOUNDS, {map: gmap}); When url points to a static url, the overlay works fine. However, when…
0
votes
1 answer

Global variable/Variable caching in Django

In my website, I want to present to the user the most viewed product categories in a sidebar, in multiple pages. so in each different view I have: variables = RequestContext(request, { (...) 'most_viewed_cats':…
user1034697
0
votes
0 answers

Is it needed to use `cache.close()` after finishing using cache in Django Views?

I found cache.close() saying below in the doc. *I'm learning Django Cache: You can close the connection to your cache with close() if implemented by the cache backend. So, I use cache.close() after I finish using cache in Django Views as shown…
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
0
votes
0 answers

How to get the expiration times of cache values properly in Django?

I set 3 cache values with timeout and get the expiration times with cache._expire_info in LocMemCache as shown below: from django.core.cache import cache cache.set("name", "John", timeout=60) cache.set("age", 36, timeout=120) cache.set("gender",…
0
votes
1 answer

Efficient storing a big table in Django cache

I use Django with jqGrid and loading pages via AJAX. At times, queries are very complex, and page loading is ver slow, for far pages is much slower (which is to be expected, the results often exceed 100k objects). I thought that result caching will…
janek37
  • 572
  • 5
  • 16
0
votes
1 answer

Django: never_cache is not working, it still shows same data on browser back button

I have a create view which is used to make an object of type Course(model). i'm using never_cache decorator to reload the page from server everytime i use it. now if i create a course it gets added in the Course database, now if i press browser back…
0
votes
3 answers

How Can I Verify that Django @cached_property is Working (caching)?

In the below example, I have questions. Example from django.utils.functional import cached_property class Product(models.Model): class ProductType(models.TextChoices): PRODUCT = 'PRODUCT', _('Product') LISTING = 'LISTING',…
Jarad
  • 17,409
  • 19
  • 95
  • 154
0
votes
0 answers

Django Redis Caching how can i set cache timeout to none (never expiring cache) in class base view

I'm using redis server for caching. Using django-redis package. Below is my setting file : CACHES = { 'default': { 'BACKEND': 'django_redis.cache.RedisCache', 'LOCATION': 'redis://127.0.0.1:6379/1', 'OPTIONS': { …