I did caching in my django application and used caching of each view through the cache API and fragment caching. On some of my pages I use my own django template tag, this tag is provided by a third-party developer, it takes some arguments in its template tags, and then makes a request to the remote server, receives a response back via XML and then displays the result on my page. Fine. I thought I could easily cache this using fragment caching, so I:
{% load cache %} {% cache 500 request.user.username %} {% load third party custom tags %} {% expensive custom tag set that gets stuff from a third party server via xml %} {{ some.stuff}} {% endcache %}
The problem is what I am doing, requests are still being fired to this remote server, it seems that Django does not like to cache these custom template tags. I know memcached works fine, for other views and templates everything works fine. Am I doing something that is incompatible with fragment caching? Is there any way around this?
, , , memcached . , , , Django, . HTTP-, , ( ) - .
, , , - , .
? request.user.username :
, request.user.username ,
, 3
, :
{% cache 500 customxml %}
{% load cache third_party_custom_tags %} {% cache 500 request.user.username %} {% expensive custom tag set that gets stuff from a third party server via xml %} {{ some.stuff}} {% endcache %}
, - . , , , , Django low- .
, , .
, request.user.username , , (, ), .
, , , . , , - - , , ( XML , Django, , ). Django, XML- (), , -, .
, - .
Django, , , . . , ( , ) , . , , ( - ), , .
django/templatetags/cache.py. 63 .
Source: https://habr.com/ru/post/1721123/More articles:How often should applications be subjected to load or load? - testingHow to invalidate cache when changing a page using Ajax? - jqueryMoving focus in response to keyboard events in XAML - wpfHow to distribute variable sized structures in memory? - c ++Subversion Automation with C # - c #How to configure maven for two separate projects that depend on the same jar - javaReplacing an Xcode Preprocessor with a User Process - preprocessorУстановить размещение контента в общедоступных типах файлов в Rails? - rubyC # - How to deal with 2 "TopMost" forms? - c #Do these regular calls to the Perl routines? - methodsAll Articles