{ "info": { "author": "Johannes Ebke", "author_email": "johannes@ebke.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7" ], "description": "app\\_json\\_file\\_cache\n======================\n\nProvides a function decorator that caches the return value in a JSON file in the appropriate application cache directory.\n\nIt requires all function parameters and return values to be encodeable to JSON, so that the cache is human-readable.\n\nIt supports a \"vary\" guard value (e.g. a data model version) that protects against using old versions of cache.\n\nAdditionally, a cheaper default function (e.g. returning shipped, precalculated values) can be specified as a stand-in\nuntil an explicit recalculate function is called.\n\n.. image:: https://travis-ci.org/JohannesEbke/app_json_file_cache.svg?branch=master\n :target: https://travis-ci.org/JohannesEbke/app_json_file_cache\n\n\nUsage\n-----\n\nExample usage::\n\n from app_json_file_cache import AppCache\n cache = AppCache(\"myapp\")\n\n @cache(\"expensive\")\n def expensive_function():\n return calculator()\n\nMore Example usage::\n\n from app_json_file_cache import AppCache\n cache = AppCache(\"myapp\")\n\n @cache(\"expensive\", vary=VERSION)\n def expensive_function(param):\n return calculator(param)\n\n expensive_function.recalculate(param1) # recalculate if external effects change\n\nUsing a default function until the next recalculate::\n\n from app_json_file_cache import AppCache\n cache = AppCache(\"myapp\")\n\n def cheap_standin(param):\n return estimate(param)\n\n @cache(\"expensive\", vary=VERSION, cheap_default_func=cheap_standin)\n def expensive_function(param):\n return calculator(param)\n\n expensive_function(param1) # cheap_standin is used\n expensive_function.recalculate(param1) # cache is updated with expensive_function\n expensive_function(param1) # cached value from expensive_function is used\n\nCaveats\n-------\n\n* Names must be unique per app. If you reuse names, chaos ensues.\n* Each set of function parameter values creates a new file. This may lead to too many files in a directory on some systems.\n* Mixing positional and keyword arguments is not supported\n* It's your responsibility that return values are serializable to JSON.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/JohannesEbke/app_json_file_cache", "keywords": "xdg json cache appdirs", "license": "", "maintainer": "", "maintainer_email": "", "name": "app-json-file-cache", "package_url": "https://pypi.org/project/app-json-file-cache/", "platform": "", "project_url": "https://pypi.org/project/app-json-file-cache/", "project_urls": { "Homepage": "https://github.com/JohannesEbke/app_json_file_cache" }, "release_url": "https://pypi.org/project/app-json-file-cache/0.2.2/", "requires_dist": [ "appdirs" ], "requires_python": "", "summary": "Simple user directory respecting JSON cache for expensive functions.", "version": "0.2.2" }, "last_serial": 5140441, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "d2b8af33920f7718dbf777fe82c501fb", "sha256": "e691f868c6832f131a8b5071f0289a570da21cfdf6e476b1da1b0dea3691a277" }, "downloads": -1, "filename": "app_json_file_cache-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d2b8af33920f7718dbf777fe82c501fb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4350, "upload_time": "2019-03-15T16:35:17", "url": "https://files.pythonhosted.org/packages/93/f1/9532379388cb1eb541623d9309b803393e3c6a6ea30c19116f96f6eef6d3/app_json_file_cache-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5564241d59356cab96d2b6cbc0becaac", "sha256": "4ecc244f2654f42a999544822ae4d548132a0f4357f65979857d8072917a853a" }, "downloads": -1, "filename": "app_json_file_cache-0.1.0.tar.gz", "has_sig": false, "md5_digest": "5564241d59356cab96d2b6cbc0becaac", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3003, "upload_time": "2019-03-15T16:35:19", "url": "https://files.pythonhosted.org/packages/db/0f/05c4b9c205df766ada7d96d2c145c45c2146067a8c798b84face78b581ca/app_json_file_cache-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e14c25950e0d84073963973fdfc39686", "sha256": "5072b645fdad05f96c2cca5e0887c5935674b9e36aa9506213512d2d638ba9b1" }, "downloads": -1, "filename": "app_json_file_cache-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e14c25950e0d84073963973fdfc39686", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4481, "upload_time": "2019-03-15T16:44:39", "url": "https://files.pythonhosted.org/packages/50/bf/b1adead01245cb5c00df84994ba2750dcd0aa6dc62be203bc84b7b4f4f2d/app_json_file_cache-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5561a3e6fff1806efd02b6bfe0873a5d", "sha256": "ed2a75b06b04c787b0fbddaf6e4e081bdd4c750167ac11e43ed91fe46f97dfb8" }, "downloads": -1, "filename": "app_json_file_cache-0.1.1.tar.gz", "has_sig": false, "md5_digest": "5561a3e6fff1806efd02b6bfe0873a5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3134, "upload_time": "2019-03-15T16:44:40", "url": "https://files.pythonhosted.org/packages/96/52/4f0066365bd368cd7cb6fefe243461c58006ebc97d7e387cd50be7aa4cae/app_json_file_cache-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c759c1b5eaea7b6cdbf76603cb7c5928", "sha256": "06cf03bc95180eb64061f4a9ec0315bdc279a83f2556076dfbe864d065802d0c" }, "downloads": -1, "filename": "app_json_file_cache-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c759c1b5eaea7b6cdbf76603cb7c5928", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5281, "upload_time": "2019-03-18T19:22:47", "url": "https://files.pythonhosted.org/packages/4c/45/96d0fac0f29d4d39869e28fefc6504d7a126f73c4a0d01f69e96abf417b6/app_json_file_cache-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "afe05b2511987823c2b50ebef503a6a7", "sha256": "120c404789fb99907b3e8878d55cbfcff2c6e0bf14943a5c14a33dcf98eee9fd" }, "downloads": -1, "filename": "app_json_file_cache-0.1.2.tar.gz", "has_sig": false, "md5_digest": "afe05b2511987823c2b50ebef503a6a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3265, "upload_time": "2019-03-18T19:22:48", "url": "https://files.pythonhosted.org/packages/be/08/b55ade1681662def16ccc76e27dd330ebf4b518d2a0a008ecf49a09debdd/app_json_file_cache-0.1.2.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "273f17f545b0b83e91fbee45e7acbc1a", "sha256": "1e70a51ca61d964d4dbd1c2adfb3312dbb83eb22e54b3aa095d191a59625eb44" }, "downloads": -1, "filename": "app_json_file_cache-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "273f17f545b0b83e91fbee45e7acbc1a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6107, "upload_time": "2019-04-14T10:29:00", "url": "https://files.pythonhosted.org/packages/58/80/5be4ba862d01eddd301daa92d61d846c8638b4b7ae7d3eb0a97c59213fb5/app_json_file_cache-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a3284128f5aa696b8af71700272b8f6", "sha256": "02f7544c6f8bc4c6dd88548b73b8871624fbf3ff0a955b2f91b9986e89085060" }, "downloads": -1, "filename": "app_json_file_cache-0.2.2.tar.gz", "has_sig": false, "md5_digest": "1a3284128f5aa696b8af71700272b8f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3831, "upload_time": "2019-04-14T10:29:02", "url": "https://files.pythonhosted.org/packages/d8/d1/50f448873605888a6039bb60b15ca12d7f91005f7afd425eb762e30c930c/app_json_file_cache-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "273f17f545b0b83e91fbee45e7acbc1a", "sha256": "1e70a51ca61d964d4dbd1c2adfb3312dbb83eb22e54b3aa095d191a59625eb44" }, "downloads": -1, "filename": "app_json_file_cache-0.2.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "273f17f545b0b83e91fbee45e7acbc1a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6107, "upload_time": "2019-04-14T10:29:00", "url": "https://files.pythonhosted.org/packages/58/80/5be4ba862d01eddd301daa92d61d846c8638b4b7ae7d3eb0a97c59213fb5/app_json_file_cache-0.2.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a3284128f5aa696b8af71700272b8f6", "sha256": "02f7544c6f8bc4c6dd88548b73b8871624fbf3ff0a955b2f91b9986e89085060" }, "downloads": -1, "filename": "app_json_file_cache-0.2.2.tar.gz", "has_sig": false, "md5_digest": "1a3284128f5aa696b8af71700272b8f6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3831, "upload_time": "2019-04-14T10:29:02", "url": "https://files.pythonhosted.org/packages/d8/d1/50f448873605888a6039bb60b15ca12d7f91005f7afd425eb762e30c930c/app_json_file_cache-0.2.2.tar.gz" } ] }