{ "info": { "author": "Torgeir Lorange \u00d8stby", "author_email": "torgeilo@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development" ], "description": "=============\nantidogpiling\n=============\n\nThis package provides a generic implementation and Django specific cache backends for anti-dogpiled caching. Django 1.2 and later are supported.\n\nDogpiling is the effect of everyone rushing to renew a value that has timed out in a cache, for as long as a new value has not yet been set. Anti-dogpiling tries do mitigate this by limiting how many gets to produce a new value. How the limiting is done, and what happens to everyone else, depends on the solution.\n\nThe solution provided in this package serves the old value from the cache while a new one is being produced. This is achieved by introducing a soft timeout for when the value should be renewed, in addition to the regular hard timeout (for when the value is no longer in the cache). At the event of a soft timeout, the first request is responded with a cache miss, and will go on to produce a new value, while subsequent requests are responded with the value that is still cached. When a new value is ready, it simply replaces the old value, and a new soft timeout is set.\n\nIn this particular implementation, as few requests as possible are let through to produce the new value, without using any locks (I have not tested using locks. Locking across servers could be tricky and undesirable. Unless letting only *one* call through to renew a value is a hard requirement, locking might not be worth the trouble).\n\nSee the `Benefits and caveats`_ section for important details.\n\nUsing the anti-dogpiled Django backends\n=======================================\n\nThe anti-dogpiled Django backends are configured like Django's own backends. See the `Setting up the cache `_ in the Django documentation for details.\n\nDjango 1.2\n----------\n\nSimply set the ``CACHE_BACKEND`` setting to point to the right module. Examples::\n\n CACHE_BACKEND = 'antidogpiling.django.memcached://127.0.0.1:11211/'\n CACHE_BACKEND = 'antidogpiling.django.filebased:///var/tmp/django_cache'\n\nDjango 1.3+\n-----------\n\nSimply replace the ``BACKEND`` reference with the corresponding anti-dogpiled backend. An example::\n\n CACHES = {\n 'default': {\n 'BACKEND': 'antidogpiling.django.memcached.MemcachedCache',\n 'LOCATION': '127.0.0.1:11211'.\n },\n }\n\nConfiguration options\n---------------------\n\nSee the `cache options setting `_ in the Django documentation on how to specify caching options.\n\nUse the ``hard_timeout_factor`` option to control how much longer the hard timeout should be, relative to the soft timeout. The default is 8, so by default, the hard timeout is 8 times longer than the soft timeout. (The point is not to be able to specify an exact hard timeout, but to ensure that values stay in the cache for a sufficient amount of time for the anti-dogpiling to have an effect, and for unused values to eventually disappear from the cache.)\n\nUse the ``default_grace_time`` option to set the timeout (in seconds) for *renewing* a value that has timed out softly. After this period, another client will be allowed to try producing a new value. The default is 60 seconds. The grace time can also be specified per call by using the ``grace_time`` parameter on the ``add`` and ``set`` methods.\n\nAn example for Django 1.3+::\n\n CACHES = {\n 'default': {\n 'BACKEND': 'antidogpiling.django.memcached.MemcachedCache',\n 'LOCATION': '127.0.0.1:11211'.\n 'OPTIONS': {\n 'hard_timeout_factor': 100,\n 'default_grace_time': 10,\n },\n },\n }\n\nClient usage\n------------\n\nThe ``add``, ``get``, ``set``, and ``delete`` methods work as usual, except that the timeouts set or invalidated are the soft timeouts, instead of the hard timeouts. To affect the hard timeouts, and to not apply any anti-dogpiling, use the ``hard=True`` parameter on the ``add``, ``set``, and ``delete`` methods.\n\n**Note:** You must use ``hard=True`` when setting an integer to be used with the ``incr`` and ``decr`` methods. Increments and decrements require the raw integer to be stored in the cache.\n\nSee the caveats below for more details.\n\nBenefits and caveats\n====================\n\nBenefits of using this package\n------------------------------\n\n- It provides the generic functionality, for anyone to base their own solution on.\n- It wraps the cached data in a custom object---not in a tuple or dict or so---making it possible to cache tuples and dicts without conflicting with the internal workings of the anti-dogpiling.\n- It supports all Django 1.2+ cache backends, without re-implementing any Django functionality.\n\nGeneral caveats\n---------------\n\n- There is no protection against dogpiling when a value is *not* in the cache *at all*.\n\nCaveats in the Django backends\n------------------------------\n\n- The ``incr`` and ``decr`` are not anti-dogpiled due to being atomic in Memcached (at least). The anti-dogpiling would not be atomic, unless somehow implemented with locks. **Note:** When initializing a value for being incremented or decremented, one *has* to specify ``hard=True`` when calling the ``set`` method. Otherwise, the anti-dogpiling kicks in and stores a complex value which cannot be incremented (a ``ValueError`` is raised)!\n- The ``set_many``, ``get_many``, and ``delete_many`` methods are not anti-dogpiled, due to a combination of laziness and all the decisions that would have to be made about how to handle soft timeouts, etc.\n\nChange history\n==============\n\n1.1.3 (2012-07-19)\n------------------\n\n* Replaced the dynamic mixin with a regular object reference in the common\n Django backend, voiding the issue with using multiple different anti-dogpiled\n backends at the same time.\n* Added dummy Django backend.\n\n1.1.2 (2012-07-02)\n------------------\n\n* Documentation update (no functional change)\n\n1.1.1 (2011-05-29)\n------------------\n\n* Added support for Django 1.3 backends\n\n1.0.1 (2011-02-02)\n------------------\n\n* Added manifest file for proper packaging\n\n1.0 (2011-02-02)\n----------------\n\n* Initial version", "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/torgeilo/antidogpiling", "keywords": "cache caching anti-dogpiling dogpiling", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "antidogpiling", "package_url": "https://pypi.org/project/antidogpiling/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/antidogpiling/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/torgeilo/antidogpiling" }, "release_url": "https://pypi.org/project/antidogpiling/1.1.3/", "requires_dist": null, "requires_python": null, "summary": "Generic and specific implementations of anti-dogpiled caching", "version": "1.1.3" }, "last_serial": 786302, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "61ac74cfe52e5d116f9825ccc6e84f41", "sha256": "ab07f706c13b5163eec90a2d7f4c8bcbd3320119c97be9170c1cc98eeb10553c" }, "downloads": -1, "filename": "antidogpiling-1.0.1.tar.gz", "has_sig": false, "md5_digest": "61ac74cfe52e5d116f9825ccc6e84f41", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5117, "upload_time": "2011-02-02T22:09:36", "url": "https://files.pythonhosted.org/packages/d4/c5/1cc448519a12439c5fe08f201c803b42833a3ad2098ad7e541993864406e/antidogpiling-1.0.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "84d9d2a589b6e4257cc2efde04e6eb3c", "sha256": "f39b99c7f863a5c80be41d33d5399cbcc18ecda6a22d618178948ce57af1a064" }, "downloads": -1, "filename": "antidogpiling-1.1.1.tar.gz", "has_sig": false, "md5_digest": "84d9d2a589b6e4257cc2efde04e6eb3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5671, "upload_time": "2011-05-29T21:52:50", "url": "https://files.pythonhosted.org/packages/47/aa/feea05ccb400d6b49ce6d7920d84d84368e21ab1f5d62fd00b8a0943f30b/antidogpiling-1.1.1.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "1d4d0c1db00122949f96c13672fd6dc7", "sha256": "84f42415f92274e7661b5bddb013ef23f29ca6479ff213b32b946d1069708417" }, "downloads": -1, "filename": "antidogpiling-1.1.2.tar.gz", "has_sig": false, "md5_digest": "1d4d0c1db00122949f96c13672fd6dc7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7952, "upload_time": "2012-07-02T21:41:24", "url": "https://files.pythonhosted.org/packages/e3/bd/81df2f12ca251908c32c5b314b36c4bf41acfbd207d2235777b711478c68/antidogpiling-1.1.2.tar.gz" } ], "1.1.3": [ { "comment_text": "", "digests": { "md5": "693230c36ab814a28e3679401dcc587e", "sha256": "341d059b08b47a7459c9981eb2d923f406edd63eb584e269bd8b53affad5de97" }, "downloads": -1, "filename": "antidogpiling-1.1.3.tar.gz", "has_sig": false, "md5_digest": "693230c36ab814a28e3679401dcc587e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7555, "upload_time": "2012-07-19T16:46:35", "url": "https://files.pythonhosted.org/packages/be/3d/01f6ca4f0bdd075812ea94db617d4e23f0370b08dffab44feac0a7b3b160/antidogpiling-1.1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "693230c36ab814a28e3679401dcc587e", "sha256": "341d059b08b47a7459c9981eb2d923f406edd63eb584e269bd8b53affad5de97" }, "downloads": -1, "filename": "antidogpiling-1.1.3.tar.gz", "has_sig": false, "md5_digest": "693230c36ab814a28e3679401dcc587e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7555, "upload_time": "2012-07-19T16:46:35", "url": "https://files.pythonhosted.org/packages/be/3d/01f6ca4f0bdd075812ea94db617d4e23f0370b08dffab44feac0a7b3b160/antidogpiling-1.1.3.tar.gz" } ] }