{ "info": { "author": "Shoji Ihara", "author_email": "shoji.ihara@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python" ], "description": "cache_it\n====\n\n__cache_it__ is a decorator which wraps caching(read/write) routine.\nDecorated functions automatically access your memcache and get/set values depending on the situation.\nAll you have to do is decorate your function by __@cache_it__.\n\n\n## Basic Usage\n\n```python\n>>> from cache_it import init_cache, cache_it\n\n>>> init_cache(['127.0.0.1:11211'])\n\n>>> @cache_it(prefix='PREFIX:')\n>>> def cached_function(key):\n>>> return 'value'\n\n>>> cached_function('key')\n'value' # cached => key:'PREFIX:key' value:'value'\n>>> cached_function('key')\n'value' # getting from a cache\n\n```\n\n## As a method\nYou can decorate not only functions but also methods in the same way.\n\n```python\nclass User(Document)\n @cache_it(prefix='PREFIX')\n def __getitem__(self, key):\n return user[key]\n\n```\n\n## ignore_exception (False by default)\nIf you want to ignore exceptions occured when accessing memcache, you have to set \"ignore_exception\" into True.\n\n```python\n@cache_it(prefix='PREFIX', ignore_exception=True)\ndef cached_function(key):\n return 'value'\n \n```\n\n\n## ttl (24*60*60 sec by default)\n\n```python\n@cache_it(prefix='PREFIX', ttl=60) # 60sec\ndef cached_function(key):\n return 'value'\n \n```\n\n## encoder/decoder\nEncoders are called before setting a value.\nDecoders, on the other hand, are called after getting a value.\n\n```python\n@cache_it(prefix='PREFIX',\n encoder=lambda x: x['foo'],\n decoder=lambda x: {'foo': x})\ndef cached_function(key):\n return {'foo': 'bar'}\n\n\n```\n", "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/shoz/cache_it", "keywords": "memcached,test,testing,decorators", "license": "switchcache\nThe MIT License\nCopyright (c) 2014 Shoji Ihara\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "cache_it", "package_url": "https://pypi.org/project/cache_it/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cache_it/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/shoz/cache_it" }, "release_url": "https://pypi.org/project/cache_it/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Decorators for caching", "version": "0.0.1" }, "last_serial": 1127787, "releases": { "0.0.1": [ { "comment_text": "built for Darwin-13.2.0", "digests": { "md5": "71dbb69c9eda30752e2ee0c8f9b08787", "sha256": "d26266ac7b04b935e9ad6e4ee693d21f2145cd99ee18ee296791e25aa0bdd6ab" }, "downloads": -1, "filename": "cache_it-0.0.1.macosx-10.9-intel.tar.gz", "has_sig": false, "md5_digest": "71dbb69c9eda30752e2ee0c8f9b08787", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 6221, "upload_time": "2014-06-17T15:30:11", "url": "https://files.pythonhosted.org/packages/46/48/3859ec0960e0327f485177483b2d994e14036e23a0482a7b5cd586664d53/cache_it-0.0.1.macosx-10.9-intel.tar.gz" }, { "comment_text": "", "digests": { "md5": "0da67966a186583c2650c23ee23b1bfb", "sha256": "39ae8a6df9b7ae7a7f8afd79ab4d7f58fae5732cd26dbe2485eda0f1af176b26" }, "downloads": -1, "filename": "cache_it-0.0.1-py2.7.egg", "has_sig": false, "md5_digest": "0da67966a186583c2650c23ee23b1bfb", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 8089, "upload_time": "2014-06-17T15:30:14", "url": "https://files.pythonhosted.org/packages/35/ba/14f5a6ca1e58813c22083496a420488d3155c842844baeec815d2d5d486b/cache_it-0.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "9c82bb92085b87b61748166a2b9ce44c", "sha256": "599f32774aa8cf102016a77e09c4f5bbb81edf6c276b631fe8594e9fc48a7a5c" }, "downloads": -1, "filename": "cache_it-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9c82bb92085b87b61748166a2b9ce44c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2014-06-17T15:30:08", "url": "https://files.pythonhosted.org/packages/15/be/67d8872a21c9ded3d0753639ad02833a75f4544be358229c7e03ddcd254d/cache_it-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "built for Darwin-13.2.0", "digests": { "md5": "71dbb69c9eda30752e2ee0c8f9b08787", "sha256": "d26266ac7b04b935e9ad6e4ee693d21f2145cd99ee18ee296791e25aa0bdd6ab" }, "downloads": -1, "filename": "cache_it-0.0.1.macosx-10.9-intel.tar.gz", "has_sig": false, "md5_digest": "71dbb69c9eda30752e2ee0c8f9b08787", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 6221, "upload_time": "2014-06-17T15:30:11", "url": "https://files.pythonhosted.org/packages/46/48/3859ec0960e0327f485177483b2d994e14036e23a0482a7b5cd586664d53/cache_it-0.0.1.macosx-10.9-intel.tar.gz" }, { "comment_text": "", "digests": { "md5": "0da67966a186583c2650c23ee23b1bfb", "sha256": "39ae8a6df9b7ae7a7f8afd79ab4d7f58fae5732cd26dbe2485eda0f1af176b26" }, "downloads": -1, "filename": "cache_it-0.0.1-py2.7.egg", "has_sig": false, "md5_digest": "0da67966a186583c2650c23ee23b1bfb", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 8089, "upload_time": "2014-06-17T15:30:14", "url": "https://files.pythonhosted.org/packages/35/ba/14f5a6ca1e58813c22083496a420488d3155c842844baeec815d2d5d486b/cache_it-0.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "9c82bb92085b87b61748166a2b9ce44c", "sha256": "599f32774aa8cf102016a77e09c4f5bbb81edf6c276b631fe8594e9fc48a7a5c" }, "downloads": -1, "filename": "cache_it-0.0.1.tar.gz", "has_sig": false, "md5_digest": "9c82bb92085b87b61748166a2b9ce44c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4033, "upload_time": "2014-06-17T15:30:08", "url": "https://files.pythonhosted.org/packages/15/be/67d8872a21c9ded3d0753639ad02833a75f4544be358229c7e03ddcd254d/cache_it-0.0.1.tar.gz" } ] }