Found, that if set CACHE_BACKEND = 'locmem://' then caching middleware works fine.
On Mar 15, 11:40 am, muzhig <arseniy.pota...@gmail.com> wrote: > Hello! I'm trying to achieve cache site. Launched memcached, > made the necessary adjustments: > > CACHE_BACKEND = 'memcached://unix:/home/username/memcached.sock' > CACHE_MIDDLEWARE_SECONDS = 600 > CACHE_MIDDLEWARE_ANONYMOUS_ONLY = True > > added two middleware entries as it stated in the documentation > MIDDLEWARE_CLASSES = ( > 'django.middleware.cache.UpdateCacheMiddleware', > ... > 'django.middleware.cache.FetchFromCacheMiddleware', > ) > when requesting different pages on my site, I noticed that memory that > memcached process occupied > is growing - it is correct. Hence, apparently the page is cached. > But now when I request the page, I always get an answer similar to > this: > > 200 OK > Date Mon, 14 Mar 2011 18:04:43 GMT <--- always put the current server > time > Expires Mon, 14 Mar 2011 18:14:43 GMT <--- current time + 10 minutes > Last-Modified Mon, 14 Mar 2011 18:04:43 GMT <--- current time > Cache-Control max-age = 600 > > It looks as if the page is taken not from the cache and generated each > time I request it. > > I checked memcache work: connected to it, tried to SET GET DELETE > STATS - everything works fine. > > As stated in djangobook: > > > Additionally, the cache middleware automatically sets a few headers in each > > HttpResponse: > > * Sets the Last-Modified header to the current date/time when a fresh > > (uncached) version of the page is > > requested. > > So why I have Last-Modified set to current time everytime I try to > load page? > What could be the problem with fetching cached pages? > How are such problems identified? > Has anyone encountered a similar problem? > > Thanks in advance! -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.