{ "info": { "author": "Novapost Team", "author_email": "peopleask@novapost.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "Python pussy cache\n==================\n\nPython pussy cache is a Cache system for python objects.\n\nCache backends can be in-memory or redis/ You can even use the django\ncache framework with Python-pussy-cache.\n\nGiven a one of the cache backends and any Python class you have\ndefine, Python-pussy-cache will cache the results of methods you have\ndefine and will also manage the cache invalidation by timestamp or\nwith methods you have defined.\n\n[![Build Status](https://secure.travis-ci.org/novapost/python-pussycache.png?branch=master)](https://travis-ci.org/novapost/python-pussycache)\n[![python-pussycache](https://pypip.in/v/pussycache/badge.png)](https://crate.io/packages/pussycache/)\n[![python-pussycache](https://pypip.in/d/pussycache/badge.png)](https://crate.io/packages/pussycache/)\n\n\nHere is an example to make the thing clearer\n\n```python\nimport time\nfrom pussycache.proxy import BaseProxy\nfrom pussycache.cache import BaseCacheBackend\n# Here is a simple class where some methods need to be cached\n\nclass MyClass(object):\n\n def a_long_task(self, delta):\n time.sleep(delta)\n return delta\n\n def forget_about_time(self):\n return None\n\n# We set an in memory cache backend with a TTL of 30 seconds.\n\ncache = BaseCacheBackend(30)\n\ncache_proxy = BaseProxy(MyClass(), cache=cache,\n cached_methods=[\"a_long_task\"],\n invalidate_methods={\"forget_about_time\": [\"a_long_task\"]})\n\ncachedinstance = cache_proxy\n# your cachedinstance is now\n# ready to use. It will just work like a regular MyClass object\n\nprint cachedinstance.a_long_task(10)\n# 10 seconds later\n10\n# if we call the same method a second time:\nprint cachedinstance.a_long_task(10)\n10\n# result is returned immediatly because it's in the cache\n# but\nprint cachedinstance.a_long_task(3)\n3\n# with different parameters, the result is not cached yet.\n# if you want to invalidate the cache for this method:\nprint cachedinstance.forget_about_time()\nprint cachedinstance.a_long_task(10)\n# 10 seconds later\n10\n```\n\nOf course, If you need direct access to the cache backend, you can\ncall it directly. Let's say you need to invalidate ALL the cache :\n\n```python\n\ncachedinstance._cache.clear()\n```\n\nThe same apply if you need to call directly the cache:\n\n```python\ncachedinstance.\\_cache.set(\"mykey\", \"my value\", 10)\ncachedinstance.\\_cache.get(\"mykey\")\n\"my value\"\n#and 10 seconds later:\ncachedinstance.\\_cache.get(\"mykey\")\n#the value is gone from the cache\n```\n\n\nTests\n-----\n\nTo run test, just install tox with ``pip install tox`` and run\n\n tox", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/novapost/pussycache", "keywords": "cache", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pussycache", "package_url": "https://pypi.org/project/pussycache/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pussycache/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/novapost/pussycache" }, "release_url": "https://pypi.org/project/pussycache/1.4/", "requires_dist": null, "requires_python": null, "summary": "Cache Backend system for python objects", "version": "1.4" }, "last_serial": 993362, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "96ab035b041d5112b100caab1bf33fda", "sha256": "c558433e8ee16faa69cfa4bb94464d124d39f1f6da48da03a152f5923d1953ee" }, "downloads": -1, "filename": "pussycache-1.0.zip", "has_sig": false, "md5_digest": "96ab035b041d5112b100caab1bf33fda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7582, "upload_time": "2014-01-31T14:56:01", "url": "https://files.pythonhosted.org/packages/da/99/679d30fa778be0add6a91165ee8f400633d261a8228112c72852ada4fe47/pussycache-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "f5fc273b512b6fe205845cfb8c0202ee", "sha256": "f5f6d298d8b8c05191c64a3720f9bc498a52a783e3d79254d01cdec40d5dab31" }, "downloads": -1, "filename": "pussycache-1.1.zip", "has_sig": false, "md5_digest": "f5fc273b512b6fe205845cfb8c0202ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11111, "upload_time": "2014-01-31T15:25:23", "url": "https://files.pythonhosted.org/packages/72/2a/b0404701a432b712f90e37ac99724b3837aef014e3332bda47e7e73c1588/pussycache-1.1.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "0840b67cc987b537797055b1cb63fe8f", "sha256": "78ad564fe128d9229272c930ee4459df8007d7662afeed285d8f01f652daa5ce" }, "downloads": -1, "filename": "pussycache-1.2.zip", "has_sig": false, "md5_digest": "0840b67cc987b537797055b1cb63fe8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12135, "upload_time": "2014-02-03T15:40:56", "url": "https://files.pythonhosted.org/packages/94/86/27f5086747be2ab3a19ef710edab4253b780ad1fee650b6cab9d53105d29/pussycache-1.2.zip" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "d44e50f6df8f89f130c6d60236b44118", "sha256": "03f5866b05cb6b741b072a308b5dceb222ad9a62b9d3ebab1ebdd4ebc86315e6" }, "downloads": -1, "filename": "pussycache-1.3.zip", "has_sig": false, "md5_digest": "d44e50f6df8f89f130c6d60236b44118", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12058, "upload_time": "2014-02-05T15:31:54", "url": "https://files.pythonhosted.org/packages/18/ed/9b94c617453ca9d8c83028a469f2a348514ccf0e577fc17ddd2203361f85/pussycache-1.3.zip" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "063ce4debf702cd8adf04c7306cccc0a", "sha256": "71e6774f2064b147834ee64c264dc63b4bf884b95229214a9c5ab7ccaeac6e7d" }, "downloads": -1, "filename": "pussycache-1.4.zip", "has_sig": false, "md5_digest": "063ce4debf702cd8adf04c7306cccc0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12418, "upload_time": "2014-02-07T10:40:00", "url": "https://files.pythonhosted.org/packages/c1/f0/806a7b6dc0c2953689afc124e01c5cab4331f20e19073b012d24487e4d7a/pussycache-1.4.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "063ce4debf702cd8adf04c7306cccc0a", "sha256": "71e6774f2064b147834ee64c264dc63b4bf884b95229214a9c5ab7ccaeac6e7d" }, "downloads": -1, "filename": "pussycache-1.4.zip", "has_sig": false, "md5_digest": "063ce4debf702cd8adf04c7306cccc0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12418, "upload_time": "2014-02-07T10:40:00", "url": "https://files.pythonhosted.org/packages/c1/f0/806a7b6dc0c2953689afc124e01c5cab4331f20e19073b012d24487e4d7a/pussycache-1.4.zip" } ] }