Questions tagged [django-cache-machine]

django-cache-machine is a pluggable Django app that provides automatic caching and invalidation for Django models through the ORM

django-cache-machine is a pluggable Django app that provides automatic caching and invalidation for Django models through the ORM.

15 questions
19
votes
2 answers

Determine if an attribute is a `DeferredAttribute` in django

The Context I have located a rather critical bug in Django Cache Machine that causes it's invalidation logic to lose its mind after a upgrading from Django 1.4 to 1.7. The bug is localized to invocations of only() on models that extend cache…
nsfyn55
  • 14,875
  • 8
  • 50
  • 77
9
votes
4 answers

Why is Django returning stale cache data?

I have two Django models as shown below, MyModel1 & MyModel2: class MyModel1(CachingMixin, MPTTModel): name = models.CharField(null=False, blank=False, max_length=255) objects = CachingManager() def __str__(self): return ";…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
3
votes
0 answers

Overwriting Manager in Django using django-cache-machine

Since the django-cache-machine override the objects model attribute, the right way to modify the queryset is as follows: class ModelAQuerySet(models.query.QuerySet): def foo(self): return self.filter(name='foo') class…
Patrick Bassut
  • 3,310
  • 5
  • 31
  • 54
3
votes
2 answers

django-cache-machine and Redis

I'm trying to use django-cache-machine to cache queries within my application, but I want to use Redis as a backend. The docs don't really explain how to do this, yet the repository is filled with Redis references, so I'm pretty sure it's possible.…
acjay
  • 34,571
  • 6
  • 57
  • 100
2
votes
1 answer

Configuring Django Cache Machine on Heroku Memcachier?

I would like to use the awesome Cache Machine Django app (https://github.com/jbalogh/django-cache-machine) using Memcachier on Heroku. From what I understand, Cache Machine does not work out of the box with Memcachier because Memcachier requires…
Jake
  • 809
  • 1
  • 8
  • 18
1
vote
2 answers

How to run Django app with Gunicorn/WSGI webserver?

I have my existing Django application running locally on my MacBook. It's directory structure looks something like this: myproject/ mySite/ __init__.py settings.py urls.py wsgi.py myApp1/ __init__.py …
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
1
vote
2 answers

Bug in Django CacheMachine ignores saving of Model?

I have a very simple Django class: from django.db import models class MyClass(models.Model): a = models.IntegerField() b = models.IntegerField() def __str__(self): return "MyClass #%s: a: %s, b %s" % (self.pk, self.a,…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
1
vote
1 answer

How to get Django Cache Machine to work on django.contrib.auth.models.User?

I'm using Django Cache Machine to cache my Django ORM objects. It's a great piece of software. It has immensely reduced the database accesses for nearly all my models -- and it is simple to use. However, one model is still not being cached:…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
1
vote
2 answers

What are the correct steps to set up django-cache-machine?

I am new to Django and caching and is using Django 1.6. I followed the instructions on django-cache-machine' page to install it. 1.pip install django-cache-machine 2.Add following to settings.py CACHES = { 'default': { 'BACKEND':…
timkung
  • 99
  • 4
  • 10
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
1 answer

Django: How do I use Cache Machine to cache a model that uses GeoManager?

I'm using Cache Machine's Cache Manager on my non-geographic models using the pattern in the docs: from django.db import models from caching.base imoprt CachingManager, CachingMixin class Zomg(CachingMixin, models.Model): val =…
Kim
  • 185
  • 8
1
vote
0 answers

Some queries not being queryset cached by django-cache-machine / django-johnny-cache

I am looking to cache some rarely updated data coming from several related tables in DB (MySQL to be specific). I have tried django ORM queryset caching with the above django apps but have stumbled into some weird behavior with both of them: some of…
Nick
  • 109
  • 5
0
votes
1 answer

Django custom cache_page decorater returns error on the only first run afterwards it's ok

I created custom cache_page decorator for my app. It doesnt work on the first run and throwing error related to middleware: content_encoding = response.get("Content-Encoding", "") AttributeError: 'bool' object has no attribute 'get' But on the…
0
votes
1 answer

Django Cache-Machine cache invalidation does not work in admin

I installed cache-machine for my Django 1.6 project as described here: http://cache-machine.readthedocs.org/en/latest/ Now in django's admin, I cannot see new entries anymore. Cache invalidation does not work. I can see that the entry is beeing…
-2
votes
1 answer

What kind of Django has caches

For example, there are caches like hazelcast. So in django cache types which have ? Whichever is most preferably ?