Caching sitemaps in Django

前端 未结 4 1539
日久生厌
日久生厌 2020-12-31 16:44

I implemented a simple sitemap class using Django\'s default sitemap application. As it was taking a long time to execute, I added manual caching:

class Short         


        
4条回答
  •  情话喂你
    2020-12-31 17:02

    Assuming you don't need all those pages in your sitemap then reducing the limit to get the file size down will work fine as described in the previous answer.

    If you do want a very large sitemap and do want to use Memcached you could split the content up into multiple chunks, store them under individual keys and then put them back together again on output. To make this more efficient, Memcached supports the ability to get multiple keys at the same time, although I'm not sure whether the Django client supports this capability yet.

    For reference, the 1 MB limit is a feature of Memcached to do with how it stores data: http://code.google.com/p/memcached/wiki/FAQ#What_is_the_maximum_data_size_you_can_store?_(1_megabyte)

提交回复
热议问题