{ "info": { "author": "Simon de Haan", "author_email": "simon@praekeltfoundation.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==================================\nDjango Fragment Cache Invalidation\n==================================\n\nFragment cache invalidation by using a per model version token to prefix the cache keys. The version token can either be an internal memcached counter or a timestamped attribute from the model, such as `updated_at`.\n\nInstallation\n------------\n\nInstall with `pip` or with `python setup.py install` and add 'cachesweeper' to your `settings.INSTALLED_APPS`\n\n\npost_save cache sweeper\n-----------------------\n\nAn example setup; an article has many comments, each comment is cached, a single vote should invalidate the comment's specific cached fragment as well as the total article's page.\n \n**Template fragment caching**\n\n`{% cachesweeper %}` takes a Django ORM model as its first argument, the expiry time as its second and any following arguments are used to construct the rest of the cache key\n\n::\n\n {% load markup %}\n {% load cachesweeper_tags %}\n {% cachesweeper comment 500 \"comment.xml\" %}\n

\n {{comment.user}} said at {{comment.created_at}}:
\n {{comment.content|markdown}}\n
\n Like ({{comment.likes.count}})\n Dislike ({{comment.dislikes.count}})\n

\n {% endcachesweeper %}\n\n**Invalidating the fragment when the model changes**\n\nOn a post_save invalidate the cache for the given model. There are two options, either have Memcached keep an internal version counter for each model or using the keyword `using` as a means of versioning the cache.\n\n::\n \n from cachesweeper.utils import invalidate_cache_for\n \n # using Memcached's internal counter\n def invalidate_vote_cache(sender, **kwargs):\n vote = kwargs.get('instance')\n invalidate_cache_for(vote.comment)\n \n post_save.connect(invalidate_vote_cache, sender=Vote)\n \n \n # using a model's attribute\n def invalidate_article_cache(sender, **kwargs):\n article = kwargs.get('instance')\n invalidate_cache_for(article, using='updated_at')\n \n post_save.connect(invalidate_article_cache, sender=Article)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/smn/django-cache-sweeper", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-cache-sweeper", "package_url": "https://pypi.org/project/django-cache-sweeper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-cache-sweeper/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/smn/django-cache-sweeper" }, "release_url": "https://pypi.org/project/django-cache-sweeper/0.1.2/", "requires_dist": null, "requires_python": null, "summary": "Lazy Django fragment cache sweeping", "version": "0.1.2" }, "last_serial": 789225, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "615068d3066c63cc497a72f104e31166", "sha256": "b461a6a5783cdf501e879824c968ce81815f77b03886f493119a5721cde666a4" }, "downloads": -1, "filename": "django_cache_sweeper-0.1-py2.6.egg", "has_sig": false, "md5_digest": "615068d3066c63cc497a72f104e31166", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 13330, "upload_time": "2011-01-19T20:45:03", "url": "https://files.pythonhosted.org/packages/c4/a1/9ac5b5becbbb492b7c7f9ec3bc7c2cdb6e8c4f018f9c1288ee235425923b/django_cache_sweeper-0.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "151af4617ec36708c234b76302127e03", "sha256": "66df0356fbbd287e51d3902bb3fdd80a470565356695a5d31968da02e4d8877a" }, "downloads": -1, "filename": "django-cache-sweeper-0.1.tar.gz", "has_sig": false, "md5_digest": "151af4617ec36708c234b76302127e03", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5121, "upload_time": "2011-01-19T20:45:13", "url": "https://files.pythonhosted.org/packages/c8/ea/33394376c9ae52ca81f365eac042861413d3e5c29dd24b3a476ede4432e3/django-cache-sweeper-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "bbadf2abb7f03013b579cb5d0acebf79", "sha256": "9df563932ce58cafe3a6bc9bc8975ced07198ccfea43430c14d2701e5482f8ea" }, "downloads": -1, "filename": "django_cache_sweeper-0.1.1-py2.6.egg", "has_sig": false, "md5_digest": "bbadf2abb7f03013b579cb5d0acebf79", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 14561, "upload_time": "2011-01-21T16:04:12", "url": "https://files.pythonhosted.org/packages/10/b1/200c86fe409b58a7a3d9887060c2854b1da4ae10f20176b094b1726527a3/django_cache_sweeper-0.1.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "27e50674c323dc908ba0777627f06223", "sha256": "ee2c52abfee9691c695db8a3661ef98432fe8630ea93e86ac742ea65d94c0703" }, "downloads": -1, "filename": "django-cache-sweeper-0.1.1.tar.gz", "has_sig": false, "md5_digest": "27e50674c323dc908ba0777627f06223", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6028, "upload_time": "2011-01-21T16:04:23", "url": "https://files.pythonhosted.org/packages/f7/19/946feacb3f757ea7e62f3c4d487054d8e94556e685536d58583d793fc589/django-cache-sweeper-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "d67e13dc942fa4c469cb98966cd23076", "sha256": "12e03eb3a666aff8f3b707b3f292a6d0d72f46dd4cc7a4a821ceb6b7c4a53cbb" }, "downloads": -1, "filename": "django_cache_sweeper-0.1.2-py2.6.egg", "has_sig": false, "md5_digest": "d67e13dc942fa4c469cb98966cd23076", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 14785, "upload_time": "2011-01-26T14:06:19", "url": "https://files.pythonhosted.org/packages/98/15/2b75cfb8b17281e269cdc7601113b6a03a814add3b681dd2119dc8b93db5/django_cache_sweeper-0.1.2-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "02545bd319d1027c61f8df0ccc486332", "sha256": "f2c89a3ffce1cb92e317c24d65fabff2ce00e7ee44b5cffc9e5fc8d07ec4d2f6" }, "downloads": -1, "filename": "django-cache-sweeper-0.1.2.tar.gz", "has_sig": false, "md5_digest": "02545bd319d1027c61f8df0ccc486332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6175, "upload_time": "2011-01-26T14:06:27", "url": "https://files.pythonhosted.org/packages/71/6f/f570d5c1b4069e8b07873810a058a26bb4d768433b6e86d6c1340691978e/django-cache-sweeper-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d67e13dc942fa4c469cb98966cd23076", "sha256": "12e03eb3a666aff8f3b707b3f292a6d0d72f46dd4cc7a4a821ceb6b7c4a53cbb" }, "downloads": -1, "filename": "django_cache_sweeper-0.1.2-py2.6.egg", "has_sig": false, "md5_digest": "d67e13dc942fa4c469cb98966cd23076", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 14785, "upload_time": "2011-01-26T14:06:19", "url": "https://files.pythonhosted.org/packages/98/15/2b75cfb8b17281e269cdc7601113b6a03a814add3b681dd2119dc8b93db5/django_cache_sweeper-0.1.2-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "02545bd319d1027c61f8df0ccc486332", "sha256": "f2c89a3ffce1cb92e317c24d65fabff2ce00e7ee44b5cffc9e5fc8d07ec4d2f6" }, "downloads": -1, "filename": "django-cache-sweeper-0.1.2.tar.gz", "has_sig": false, "md5_digest": "02545bd319d1027c61f8df0ccc486332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6175, "upload_time": "2011-01-26T14:06:27", "url": "https://files.pythonhosted.org/packages/71/6f/f570d5c1b4069e8b07873810a058a26bb4d768433b6e86d6c1340691978e/django-cache-sweeper-0.1.2.tar.gz" } ] }