{ "info": { "author": "David Ziegler", "author_email": "david.ziegler@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "Django-cachebot\n=================\n\nDjango-cachebot provides automated caching and invalidation for the Django ORM. \n\nInstallation\n************\n\n1. ``easy_install django-cachebot`` or ``pip install django-cachebot``\n \n2. Add ``cachebot`` to your ``INSTALLED_APPS``\n\n3. Set a cache backend to one of the backends in ``cachebots.backends``, for instance:: \n\n CACHES = {\n 'default': {\n 'BACKEND': 'cachebot.backends.memcached.MemcachedCache',\n 'LOCATION': '127.0.0.1:11211',\n }\n }\n\nCurrent supported backends are:: \n\n cachebot.backends.dummy.DummyCache\n cachebot.backends.memcached.MemcachedCache\n cachebot.backends.memcached.PyLibMCCache\n\n\n4. If you want to add caching to a model, the model's manager needs to be ``CacheBotManager`` or a subclass of it, e.g::\n \n from django.db import models\n from cachebot.managers import CacheBotManager\n \n class Author(models.Model):\n name = models.CharField(max_length=50)\n objects = CacheBotManager()\n \n class BookManager(CacheBotManager):\n \n def for_author(self, name):\n return self.filter(author__name=name)\n \n class Book(models.Model):\n title = models.CharField(max_length=50)\n author = models.ForeignKey(Author)\n objects = BookManager()\n \nUsage\n******\n\nBy default, all ``get`` queries for ``CacheBotManager`` will be cached::\n \n photo = Photo.objects.get(user=user)\n\nIf you don't want this behavior, call ``CacheBotManager(cache_get=False)`` when defining the manager, or to change this globally set ``CACHEBOT_CACHE_GET=False`` in settings.\n\n------------\n\nFor more complex queries, suppose you had a query that looked like this and you wanted to cache it::\n\n Photo.objects.filter(user=user, status=2)\n\nJust add ``.cache()`` to the queryset chain like so::\n\n Photo.objects.cache().filter(user=user, status=2)\n\nThis query will get invalidated if any of the following conditions are met::\n\n 1. One of the objects returned by the query is altered.\n 2. The user is altered.\n 3. A Photo is modified and has status = 2.\n 4. A Photo is modified and has user = user.\n\nThis invalidation criteria is probably too cautious, because we don't want to invalidate this cache every time a Photo with ``status = 2`` is saved. To fine tune the invalidation criteria, we can specify to only invalidate on certain fields. For example::\n \n Photo.objects.cache('user').filter(user=user, status=2)\n\nThis query will get invalidated if any of the following conditions are met::\n\n 1. One of the objects returned by the query is altered.\n 2. The user is altered.\n 3. A Photo is modified and has user = user.\n\n\ndjango-cachebot can also handle select_related, forward relations, and reverse relations, ie::\n\n Photo.objects.select_related().cache('user').filter(user__username=\"david\", status=2)\n \n Photo.objects.cache('user').filter(user__username=\"david\", status=2)\n \n Photo.objects.cache('message__sender').filter(message__sender=user, status=2)\n\n\nSettings\n********\n\n - ``CACHEBOT_CACHE_GET``\n \n - default: ``True``\n - If set to ``True``, ``CacheBotManager`` will be called with ``cache_get=True`` by default.\n\n - ``CACHEBOT_TABLE_BLACKLIST``\n \n - default: ('django_session', 'django_content_type', 'south_migrationhistory')\n - A list of tables that cachebot should ignore.\n \n\nCaveats (Important!)\n********************\n\n1. Adding/Removing objects with a ManyRelatedManager will not automatically invalidate. You'll need to manually invalidate these queries like so::\n\n from cachebot.signals import invalidate_object\n \n user.friends.add(friend)\n invalidate_object(user)\n invalidate_object(friend)\n\n2. ``count()`` queries will not get cached.\n\n3. If you're invalidating on a field that is in a range or exclude query, these queries will get invalidated when anything in the table changes. For example the following would get invalidated when anything on the User table changed::\n\n Photo.objects.cache('user').filter(user__in=users, status=2)\n\n Photo.objects.cache('user').exclude(user=user, status=2)\n \n\n4. You should probably use a tool like django-memcache-status_ to check on the status of your cache. If memcache overfills and starts dropping keys, it's possible that your queries might not get invalidated.\n\n5. .values_list() doesn't cache yet. You should do something like this instead::\n\n [photo['id'] for photo in Photo.objects.cache('user').filter(user=user).values('id')]\n\n\n.. _django-memcache-status: http://github.com/bartTC/django-memcache-status\n\nDependencies\n*************\n\n* Django 1.3\n\nIf you use Django 1.2, you can use django-cachebot version 0.3.1", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/dziegler/django-cachebot/archives/master", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/dziegler/django-cachebot", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-cachebot", "package_url": "https://pypi.org/project/django-cachebot/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-cachebot/", "project_urls": { "Download": "http://github.com/dziegler/django-cachebot/archives/master", "Homepage": "http://github.com/dziegler/django-cachebot" }, "release_url": "https://pypi.org/project/django-cachebot/0.4.1/", "requires_dist": null, "requires_python": null, "summary": "Automated caching and invalidation for the Django ORM", "version": "0.4.1" }, "last_serial": 789229, "releases": { "0.2.1": [ { "comment_text": "", "digests": { "md5": "35b96c1479eda40cdbe11141db83cad5", "sha256": "0766c776af52c53ba835403e683e41b2d9c8343fa5a90f44b9b4e1e1de618576" }, "downloads": -1, "filename": "django-cachebot-0.2.1.tar.gz", "has_sig": false, "md5_digest": "35b96c1479eda40cdbe11141db83cad5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18017, "upload_time": "2010-10-28T12:27:04", "url": "https://files.pythonhosted.org/packages/e3/c7/dd41c8972beea3cb2ebcb6f5e325df1bc2c924ade8e4323e730e6b03bf82/django-cachebot-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "0248ae8b375bf066f1f40b4a2e669120", "sha256": "8ad9650f80bd067c86fa2f2eb4dcccedeee657571cd233a0c703abc5a8702dd5" }, "downloads": -1, "filename": "django-cachebot-0.2.2.tar.gz", "has_sig": false, "md5_digest": "0248ae8b375bf066f1f40b4a2e669120", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19399, "upload_time": "2010-10-28T12:34:05", "url": "https://files.pythonhosted.org/packages/95/f5/efbe88f113780163a3752416ff4303efc23394348b61da6a4b0487331155/django-cachebot-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "391725052df6c485ff4da43f5749113e", "sha256": "e6012cdd091a0c3217f4c301f558040ea796947192d1c03519a2559ac1f13616" }, "downloads": -1, "filename": "django-cachebot-0.2.3.tar.gz", "has_sig": false, "md5_digest": "391725052df6c485ff4da43f5749113e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19463, "upload_time": "2010-10-30T23:35:34", "url": "https://files.pythonhosted.org/packages/cb/0f/fd7af13c8a4115df33250c0dcb8e6db2308b1b0159b0d3f8da930382aa73/django-cachebot-0.2.3.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "45d1892957be4ca509c0745342ddd17c", "sha256": "01833c199122cff714469f35b1d8c3ec8012f03efa43527eba6dc372bc420f49" }, "downloads": -1, "filename": "django-cachebot-0.3.0.tar.gz", "has_sig": false, "md5_digest": "45d1892957be4ca509c0745342ddd17c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20006, "upload_time": "2010-11-01T21:05:44", "url": "https://files.pythonhosted.org/packages/fe/3d/32060e9deee2c742e1f296c7257f5498e7f68d839cd27bc4d162f4c9ec14/django-cachebot-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "4238f7d9c1df01c6d302e104a4897a46", "sha256": "0c633ccbc0e9e12ffafe0d7b3e8cf801642f3155c489f82c956f67d18f442e43" }, "downloads": -1, "filename": "django-cachebot-0.3.1.tar.gz", "has_sig": false, "md5_digest": "4238f7d9c1df01c6d302e104a4897a46", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19835, "upload_time": "2010-11-01T23:39:02", "url": "https://files.pythonhosted.org/packages/86/e1/e9674ef27ecd2f89a6ba950e84e0955f21c94a1c32ed093958b4d3be070f/django-cachebot-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "a555b5213898078b0a3e356bbca9f7db", "sha256": "d9945282d123d4607f2f55a4b2c21c26604cd7b7186b77975d8c1a93b1fe8960" }, "downloads": -1, "filename": "django-cachebot-0.4.0.tar.gz", "has_sig": false, "md5_digest": "a555b5213898078b0a3e356bbca9f7db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18944, "upload_time": "2011-04-26T02:54:24", "url": "https://files.pythonhosted.org/packages/5c/97/839c8b5d1ad9a950c5367cb4e986397b1f483cbc7319d521472eb44595c9/django-cachebot-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "317be7b6127b8f8e265efa261906a519", "sha256": "1f602ee93f9d3e228ccb174fbfbe8599d897892bbaa5683ab5e3e1c68fa08df9" }, "downloads": -1, "filename": "django-cachebot-0.4.1.tar.gz", "has_sig": false, "md5_digest": "317be7b6127b8f8e265efa261906a519", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18947, "upload_time": "2011-07-18T21:14:30", "url": "https://files.pythonhosted.org/packages/e2/7a/dfc53442d6130b8ddd13ccab68b43492324e968f77b5725116ec3a52d29c/django-cachebot-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "317be7b6127b8f8e265efa261906a519", "sha256": "1f602ee93f9d3e228ccb174fbfbe8599d897892bbaa5683ab5e3e1c68fa08df9" }, "downloads": -1, "filename": "django-cachebot-0.4.1.tar.gz", "has_sig": false, "md5_digest": "317be7b6127b8f8e265efa261906a519", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18947, "upload_time": "2011-07-18T21:14:30", "url": "https://files.pythonhosted.org/packages/e2/7a/dfc53442d6130b8ddd13ccab68b43492324e968f77b5725116ec3a52d29c/django-cachebot-0.4.1.tar.gz" } ] }