{ "info": { "author": "James C. Stroud", "author_email": "jstroud@mbi.ucla.edu", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "pyfscache\n=========\n\nA simple filesystem cache for python.\n\nHome Page, Documentation, & Repository\n--------------------------------------\n\n- **Home Page**: http://pyfscache.bravais.net\n- **Online Documentation**: http://pythonhosted.org/pyfscache/\n- **Code Repository**: https://github.com/jcstroud/pyfscache/\n\n\nIntroduction\n------------\n\nPyfscache (python filesystem cache) is a filesystem cache\nthat is easy to use. The principal class is `FSCache`,\ninstances of which may be used as decorators to create cached\nfunctions with very little coding overhead:\n\n.. code-block:: python\n\n import pyfscache\n cache_it = pyfscache.FSCache('some/cache/directory',\n days=13, hours=4, minutes=2.5)\n @cache_it\n def cached_doit(a, b, c):\n return [a, b, c]\n\nIt's that simple!\n\nNow, every time the function ``cached_doit`` is called with a\nparticular set of arguments, the cache ``cache_it`` is inspected\nto see if an identical call has been made before. If it has, then\nthe return value is retrieved from the ``cache_it`` cache. If not,\nthe return value is calculated with ``cached_doit``, stored in\nthe cache, and then returned.\n\n\nExpiration\n----------\n\nIn the code above, the expiration for ``cache_it`` is set to\n1,137,750 seconds (13 days, 4 hours, and 2.5 minutes),\nwhich means that every item created by ``cache_it`` has a lifetime\nof 1,137,750 seconds, beginning when the item is made (*not*\nbeginning when ``cache_it`` is made). Values specifying lifetime\nmay be provided with the keywords ``years``, ``months``, ``weeks``,\n``days``, ``hours``, ``minutes``, and ``seconds``. The lifetime is\nthe total for all keywords.\n\nIf these optional keyword arguments are not included, then items\nadded by the `FSCache` object never expire:\n\n.. code-block:: python\n\n no_expiry_cache = pyfscache.FSCache('some/cache/directory')\n\n.. note::\n\n Several instances of `FSCache` objects\n can use the same cache directory. Each will honor\n the expirations of the items therein. Thus, it is possible\n to have a cache mixed with objects of many differening\n lifetimes, made by many instances of\n `FSCache`.\n\n\nWorks Like a Map\n----------------\n\nInstances of `FSCache` work like mapping objects, supporting\nitem getting and setting:\n\n.. code-block:: python\n\n >>> cache_it[('some', ['key'])] = {'some': 'value'}\n >>> cache_it[('some', ['key'])]\n {'some': 'value}\n\nHowever, deletion with the ``del`` statement only works on memory.\nTo erase an item in the cache directory, use ``expire``:\n\n.. code-block:: python\n\n >>> cache_it.get_loaded()\n ['LIlWpBZL68MBJaXouRjFBL3fzScyxh5q56hqSZ3DBK']\n >>> del cache_it[('some', ['key'])]\n >>> cache_it.get_loaded()\n []\n >>> ('some', ['key']) in cache_it\n True\n >>> cache_it[('some', ['key'])]\n {'some': 'value}\n >>> cache_it.expire(('some', ['key']))\n >>> ('some', ['key']) in cache_it\n False\n\nDecorators\n----------\n\nWhat if you didn't write the function you want to cache?\nAlthough their convenience is manifest in the example above,\nit is not necessary to use decorators:\n\n.. code-block:: python\n\n import pyfscache\n cache = pyfscache.FSCache('some/cache/directory',\n days=13, hours=4, minutes=2.5)\n\n def uncached_doit(a, b, c):\n return [a, b, c]\n\n cached_doit = cache(uncached_doit)\n\n\nVersatility\n-----------\n\n`FSCache` objects should work on the vast majority of python\n\"callables\", including instance methods and even built-ins:\n\n.. code-block:: python\n\n # a cached built-in\n cached_list = cache_it(list)\n\n # a cached instance method\n class AClass(object):\n @cahe_it\n def some_cached_instance_method(self, a, r, g, s):\n return (a + r) / (g * s)\n\n.. note::\n\n The rule of thumb is that if python's *cPickle* module\n can handle the expected arguments to the cached function,\n then so can pyfscache.", "description_content_type": null, "docs_url": "https://pythonhosted.org/pyfscache/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pyfscache.bravais.net", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pyfscache", "package_url": "https://pypi.org/project/pyfscache/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyfscache/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pyfscache.bravais.net" }, "release_url": "https://pypi.org/project/pyfscache/0.9.12/", "requires_dist": null, "requires_python": null, "summary": "A file system cache for python.", "version": "0.9.12" }, "last_serial": 1402114, "releases": { "0.9.10": [ { "comment_text": "", "digests": { "md5": "9ad3470642d8b159c0e445825f39fcd2", "sha256": "027ce124898c51de0be32fc8986385c2880c693b5accf2121c2541bebce8b8c2" }, "downloads": -1, "filename": "pyfscache-0.9.10.tar.gz", "has_sig": false, "md5_digest": "9ad3470642d8b159c0e445825f39fcd2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 78814, "upload_time": "2013-03-07T18:47:55", "url": "https://files.pythonhosted.org/packages/ae/80/fd352f408a695ab1fb527a5c69c19fc0e791b8aad47d5d382b14f16aacc1/pyfscache-0.9.10.tar.gz" } ], "0.9.11": [ { "comment_text": "", "digests": { "md5": "0ef8120816189b0d1b174221f1e1db4a", "sha256": "2ab86ed97d4085dbca9385e942fbba86fbc11bc14b65dc4f8dce20724c70e8fc" }, "downloads": -1, "filename": "pyfscache-0.9.11.tar.gz", "has_sig": false, "md5_digest": "0ef8120816189b0d1b174221f1e1db4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 78929, "upload_time": "2013-04-16T07:41:51", "url": "https://files.pythonhosted.org/packages/7a/eb/28975db00d06db6b20854a33c6dd9c6a62ade80b39d913d24c91eb8fd390/pyfscache-0.9.11.tar.gz" } ], "0.9.12": [ { "comment_text": "", "digests": { "md5": "1e5f98d1b5f8d414bfab640e56973017", "sha256": "8711c88009564d216daf8903831491267364074a0beafe4c761a1f006182681e" }, "downloads": -1, "filename": "pyfscache-0.9.12.tar.gz", "has_sig": false, "md5_digest": "1e5f98d1b5f8d414bfab640e56973017", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 79449, "upload_time": "2015-01-29T21:16:18", "url": "https://files.pythonhosted.org/packages/93/16/916b3eb0655ed43add20a632937716e41b5f905a71caabeb9790321b9a55/pyfscache-0.9.12.tar.gz" } ], "0.9.8": [ { "comment_text": "", "digests": { "md5": "c1add353a0785e74e47f0c65d1973140", "sha256": "94fc34de0681de1507eb71bab0bfbea8d5c4f874ef64c1134abb0c46760346a5" }, "downloads": -1, "filename": "pyfscache-0.9.8.tar.gz", "has_sig": false, "md5_digest": "c1add353a0785e74e47f0c65d1973140", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 71955, "upload_time": "2013-03-05T00:59:31", "url": "https://files.pythonhosted.org/packages/60/76/934b38e66c8131317b8d6bf7afbefead85e34f2fea656c13aa8c6d0af160/pyfscache-0.9.8.tar.gz" } ], "0.9.9": [ { "comment_text": "", "digests": { "md5": "a566af29fb9fd82ca2f02d11338b3fe9", "sha256": "6460504a371652d38dd1b224accc690a4d59a104f772fe6f24c74678147a797e" }, "downloads": -1, "filename": "pyfscache-0.9.9.tar.gz", "has_sig": false, "md5_digest": "a566af29fb9fd82ca2f02d11338b3fe9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 75964, "upload_time": "2013-03-05T20:02:12", "url": "https://files.pythonhosted.org/packages/b9/d6/bd30f82bee6e7ffd9e981e7419b35f0e48f9b363d780034694c93dbc36aa/pyfscache-0.9.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1e5f98d1b5f8d414bfab640e56973017", "sha256": "8711c88009564d216daf8903831491267364074a0beafe4c761a1f006182681e" }, "downloads": -1, "filename": "pyfscache-0.9.12.tar.gz", "has_sig": false, "md5_digest": "1e5f98d1b5f8d414bfab640e56973017", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 79449, "upload_time": "2015-01-29T21:16:18", "url": "https://files.pythonhosted.org/packages/93/16/916b3eb0655ed43add20a632937716e41b5f905a71caabeb9790321b9a55/pyfscache-0.9.12.tar.gz" } ] }