{ "info": { "author": "Alessio Bogon", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "# File System Backends for Dogpile Cache\n\n![PyPI](https://img.shields.io/pypi/v/dogpile_filesystem.svg?style=flat)\n[![Build Status](https://travis-ci.org/paylogic/dogpile_filesystem.svg?branch=master)](https://travis-ci.org/paylogic/dogpile_filesystem)\n[![Coverage Status](https://coveralls.io/repos/github/paylogic/dogpile_filesystem/badge.svg?branch=master)](https://coveralls.io/github/paylogic/dogpile_filesystem?branch=master)\n![](https://img.shields.io/pypi/pyversions/dogpile_filesystem.svg?style=flat)\n\n\n\nFilesystem-based backends for dogpile cache.\n\nThe generic variant of the backend, `paylogic.filesystem`, will accept any picklable value and it will store it in the file system.\n\nThe raw variant `paylogic.raw_filesystem` will only work with file-like values and it will avoid the pickling phase. This is useful when you are generating a big file and you don't want to keep in memory the contents of this file.\n \nBoth variants use [fcntl.lockf](https://docs.python.org/3.7/library/fcntl.html#fcntl.lockf) operations, therefore it is compatible with UNIX-like systems only.\nThe lockf system call allows to allocate an arbitrary number of locks using the same file, avoiding problems that arise when deleting lock files.\n\n\n## Installation\nInstall with pip:\n\n`$ pip install dogpile_filesystem`\n\n## Usage\n### Generic variant\nConfigure a region to use `paylogic.filesystem`:\n```python\nfrom dogpile.cache import make_region\nimport datetime\n\nregion = make_region().configure(\n 'paylogic.filesystem',\n arguments = {\n \"base_dir\": \"/path/to/cachedir\", # Make sure this directory is only for this region\n # Optional parameters\n \"cache_size\": 1024**3, # Defaults to 1 Gb\n \"expiration_time\": datetime.timedelta(seconds=30), # Defaults to no expiration\n \"distributed_lock\": True, # Defaults to true\n }\n)\n\n@region.cache_on_arguments()\ndef my_function(args):\n return 42\n```\n\n### Raw variant\nConfigure a region to use dogpile_filesystem:\n```python\nfrom dogpile.cache import make_region\nimport datetime\nimport tempfile\n\nregion = make_region().configure(\n 'paylogic.raw_filesystem',\n arguments = {\n \"base_dir\": \"/path/to/cachedir\", # Make sure this directory is only for this region\n # Optional parameters\n \"cache_size\": 1024**3, # Defaults to 1 Gb\n \"file_movable\": True, # Whether the backend can freely move the file.\n # When True, the backend will move the file to the cache\n # directory directly using os.rename(file.name).\n # When False (default), the content of the file will be copied to \n # the cache directory.\n \"expiration_time\": datetime.timedelta(seconds=30), # Defaults to no expiration\n \"distributed_lock\": True, # Defaults to true\n }\n)\n\n@region.cache_on_arguments()\ndef big_file_operation(args):\n # When using `file_movable=True`, we must make sure that NamedTemporaryFile does not delete the file on close,\n # otherwise it will complain that it cannot find the file.\n f = tempfile.NamedTemporaryFile(delete=False)\n # fill the file\n f.flush()\n f.seek(0)\n return f\n```\n\n## Development\nInstall the dev requirements and the project in development mode:\n\n`$ pip install -r requirements_dev.txt -e .`\n\nRun tests:\n\n`$ pytest tests`\n\nOptionally run tests for all supported configurations:\n\n`$ tox`\n\n\n# Changelog\nAll notable changes to this project will be documented in this file.\n\nThis project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Unreleased\n\n## 0.2.0\n- Removed logic that falls back to copying a file when `file_movable=True` but the file does not appear to be movable. Do not try to be smart.\n\n## 0.1.1\n- Let PyPI know that we use markdown\n\n## 0.1.0\n- Initial release", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/paylogic/dogpile_filesystem", "keywords": "dogpile_filesystem", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "dogpile-filesystem", "package_url": "https://pypi.org/project/dogpile-filesystem/", "platform": "", "project_url": "https://pypi.org/project/dogpile-filesystem/", "project_urls": { "Homepage": "https://github.com/paylogic/dogpile_filesystem" }, "release_url": "https://pypi.org/project/dogpile-filesystem/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "File System Backends for Dogpile Cache", "version": "0.2.0" }, "last_serial": 4824723, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "914d0f87dc651cbdf6a0382b7ccaad93", "sha256": "8e97ae2a69c353dd7052d689034c60bacd723e80fd54cc3c26de028a03885731" }, "downloads": -1, "filename": "dogpile_filesystem-0.1.1.tar.gz", "has_sig": false, "md5_digest": "914d0f87dc651cbdf6a0382b7ccaad93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12662, "upload_time": "2019-02-15T13:07:32", "url": "https://files.pythonhosted.org/packages/d1/a7/e1f5b427cf258c3f1aa315e194785f5549ad68ebe2dfd00f4718f0680258/dogpile_filesystem-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ffb282de0fb44838dfda1eaac9c2079f", "sha256": "fc71ef1e2ad47ac5e936bbf2b4069b9426d330d8e6e4915aaccffcd4fff16620" }, "downloads": -1, "filename": "dogpile_filesystem-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ffb282de0fb44838dfda1eaac9c2079f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12803, "upload_time": "2019-02-15T13:34:27", "url": "https://files.pythonhosted.org/packages/c3/48/30a00646ac4d760d68b16e8cb5f35448afa27c198eca4d27d8176f33f9c8/dogpile_filesystem-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ffb282de0fb44838dfda1eaac9c2079f", "sha256": "fc71ef1e2ad47ac5e936bbf2b4069b9426d330d8e6e4915aaccffcd4fff16620" }, "downloads": -1, "filename": "dogpile_filesystem-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ffb282de0fb44838dfda1eaac9c2079f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12803, "upload_time": "2019-02-15T13:34:27", "url": "https://files.pythonhosted.org/packages/c3/48/30a00646ac4d760d68b16e8cb5f35448afa27c198eca4d27d8176f33f9c8/dogpile_filesystem-0.2.0.tar.gz" } ] }