django-cache Questions

2

As described in the documentation, since 4.1 the default behavior for template loading changed drastically. If I understand it right, until 4.0 it worked like this: With DEBUG enabled, the templat...
Beachlamar asked 27/9, 2022 at 13:48

5

Solved

I'm using Django's per-view @cache_page decorator and have set a different key_prefix for each view. I've previously deleted the cache with: from django.core.cache import cache cache.clear() But w...
Reive asked 26/9, 2017 at 8:50

3

Solved

I have a Django application with a registered database cache: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.db.DatabaseCache', 'LOCATION': 'exchange_rate_cache', } } I want ...
Flexor asked 21/8, 2018 at 12:27

13

Solved

I'm trying to understand how Django is setting keys for my views. I'm wondering if there's a way to just get all the saved keys from Memcached. something like a cache.all() or something. I've been ...
Tacho asked 28/1, 2012 at 20:17

4

Solved

I've got a pretty simple site where I'm using the page_cache decorator. I have a cronjob that checks for new data and processes it if it's available. (This is run using management commands execute...
Suzannsuzanna asked 28/5, 2011 at 5:25

2

Solved

I was trying to use the locmem cache for my web application but couldn't find any documentation on how to see the contents of the cache. I mean I want to check if my keys are being set correctly in...
Virgule asked 29/11, 2012 at 16:28

1

I set 4 cache values with LocMemCache as shown below: from django.core.cache import cache cache.set("first_name", "John") cache.set("last_name", "Smith", ve...
Santonin asked 22/8, 2023 at 14:49

5

Solved

I am using view caching for a django project. It says the cache uses the URL as the key, so I'm wondering how to clear the cache of one of the keys if a user updates/deletes the object. An example:...
Parabolize asked 9/1, 2012 at 5:48

2

If I only set and get David with version=0, then I can get John and David in order as shown below. *I use LocMemCache which is the default cache in Django and I'm learning Django Cache: from django...
Grumpy asked 19/8, 2023 at 16:12

3

When I run python manage.py shell and then: from django.core.cache import cache cache.set("stack","overflow",3000) print cache.get("stack") (output: ) None I tried ...
Julieannjulien asked 10/9, 2012 at 18:27

10

Solved

I'm writing a django management command to handle some of our redis caching. Basically, I need to choose all keys, that confirm to a certain pattern (for example: "prefix:*") and delete them. I kn...
Melodist asked 23/2, 2014 at 22:1

3

Solved

I'm importing and using cache as this: from django.core.cache import cache cache.add('a','b',60) I haven't defined any settings for the cache in settings.py ,then where does this cache come from a...
Felon asked 31/7, 2014 at 6:35

6

Solved

I need to use memcached and file based cache. I setup my cache in settings: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 'LOCATION': 'c:/foo/bar', ...
Aylesbury asked 10/5, 2011 at 11:25

7

When using ModelChoiceField or ModelMultipleChoiceField in a Django form, is there a way to pass in a cached set of choices? Currently, if I specify the choices via the queryset parameter, it resul...

14

Solved

I'm testing out using memcached to cache django views. How can I tell if memcached is actually caching anything from the Linux command line?
Bickerstaff asked 10/3, 2009 at 19:30

2

Ive noticed that randomly some pages take from 2 to 12 seconds to load, I have Debug toolbar installed and I know my queries are all efficient (i.e. no duplicates) and toolbar shows they are all ru...
Northeasterly asked 21/11, 2019 at 14:42

2

Solved

I have this model: class Article(models.Model): title = models.CharField(max_length=300, blank=False) body = models.TextField(max_length=10000, blank=False) created = models.DateTimeField(auto_...
Mochun asked 9/12, 2015 at 21:28

2

Solved

I have a race condition in Celery. Inspired by this - http://ask.github.io/celery/cookbook/tasks.html#ensuring-a-task-is-only-executed-one-at-a-time I decided to use memcache to add locks to my tas...
Ailssa asked 9/5, 2017 at 22:43

4

Solved

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 = CachingManag...
Explosion asked 16/6, 2016 at 3:8

0

I'm looking for a way to list out the cache keys from a specific template file when using Django's (Django 2+; Python 3.5+) template caching. For example: {% load cache %} {% block header %} {% ...
Marylyn asked 17/11, 2018 at 18:34

1

Solved

I'm writing the project using Django REST Framework, Django, Postgres as database and Redis as caching. I want to dockerize my project. But Redis doesn't want to access connection. Django settings:...
Wallin asked 15/8, 2018 at 11:3

2

Solved

I trying to use Django Cache to make better my views. Works great, 400ms to 8ms is perfect. But when user access page for the first time, Django cache page with user info in header and when I try l...
Totally asked 15/9, 2017 at 13:59

1

Solved

I have followed the solution provided in Stack overflow Link & it is working perfectly when i use this from my browser. However, when i tried hitting that url with curl, it doesn't cache for th...

3

Previously, I had set up a cached chunk of HTML in my Django template as follows. {% load cache %} {% cache 10000 courseTable %} <!-- Cached HTML --> {% endcache %} Now, I have updated t...
Separatist asked 28/5, 2012 at 3:19

4

Solved

How would I go about caching pages for anonymous users but rendering them for authorized users in Django 1.6? There used to be a CACHE_MIDDLEWARE_ANONYMOUS_ONLY flag that sounded perfect, but that ...

© 2022 - 2024 — McMap. All rights reserved.