Hello all,

The public current version cache docs reference make_template_cache_key:

https://docs.djangoproject.com/en/dev/topics/cache/

django.core.cache.utils.make_template_fragment_key(fragment_name, vary_on=None)
If you want to obtain the cache key used for a cached fragment, you can use 
make_template_fragment_key. fragment_name is the same as second argument to the 
cache template tag; vary_on is a list of all additional arguments passed to the 
tag. This function can be useful for invalidating or overwriting a cached item, 
for example:
>>> from django.core.cache import cache
>>> from django.core.cache.utils import make_template_fragment_key
# cache key for {% cache 500 sidebar username %}
>>> key = make_template_fragment_key('sidebar', [username])
>>> cache.delete(key) # invalidates cached template fragment

As created for this ticket a few months ago:

https://code.djangoproject.com/ticket/19253

I've got the most recent version of Django (1.5.1) but this code is nowhere to 
be found:

(moo)bigberet:~/src/tmp/moo anderson$ django-admin.py startproject blancmange
(moo)bigberet:~/src/tmp/moo anderson$ cd blancmange/
(moo)bigberet:~/src/tmp/moo/blancmange anderson$ python manage.py shell
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.cache.utils import make_template_fragment_key
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named utils
>>> import django
>>> django.VERSION
(1, 5, 1, 'final', 0)
>>> 

Regards,
-scott

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to