{ "info": { "author": "Joeri Bekker", "author_email": "joeri@maykinmedia.nl", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Framework :: Django :: 2.0", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Communications", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Distributed Computing" ], "description": "=====================\r\nDjango DBCache Fields\r\n=====================\r\n\r\n:Version: 0.9.2\r\n:Docs: https://django-dbcache-fields.readthedocs.io/\r\n:Download: https://pypi.python.org/pypi/django_dbcache_fields\r\n:Source: https://github.com/maykinmedia/django-dbcache-fields\r\n:Keywords: django, database, cache, methods, decorator\r\n\r\n|build-status| |coverage| |lintly| |license| |pyversion| |djversion|\r\n\r\nAbout\r\n=====\r\n\r\nThis library provides a decorator ``dbcache`` that caches the result of your\r\nDjango ``Model`` methods in your database.\r\n\r\nIt adds a regular ``Field`` on your ``Model`` for each method that you\r\ndecorate. This means you can use all ORM-functions like aggregation and\r\nmigrations. You can use existing fields or let ``dbcache`` create the field\r\nfor you.\r\n\r\nYou can also invalidate the cached value by creating a _dirty_ function or by\r\nindicating which other models affect the this cached value. By default, the\r\ncached value is only updated when the model is saved.\r\n\r\nInstallation\r\n============\r\n\r\nYou can install `django_dbcache_fields` either via the Python Package Index\r\n(PyPI) or from source.\r\n\r\nTo install using `pip`:\r\n\r\n.. code-block:: console\r\n\r\n $ pip install -U django_dbcache_fields\r\n\r\nUsage\r\n=====\r\n\r\nTo use this with your project you need to follow these steps:\r\n\r\n#. Install the django_dbcache_fields library:\r\n\r\n .. code-block:: console\r\n\r\n $ pip install django_dbcache_fields\r\n\r\n#. Add ``django_dbcache_fields`` to ``INSTALLED_APPS`` in your Django\r\n project's ``settings.py``:\r\n\r\n .. code-block:: python\r\n\r\n INSTALLED_APPS = (\r\n # ...,\r\n 'django_dbcache_fields',\r\n )\r\n\r\n Note that there is no dash in the module name, only underscores.\r\n\r\n#. All done. You can now decorate methods in your ``Model`` with\r\n ``@dbcache``.\r\n\r\nExample\r\n=======\r\n\r\nSimple example to show what ``dbcache`` does:\r\n\r\n.. code-block:: python\r\n\r\n from django.db import models\r\n from django_dbcache_fields.decorators import dbcache\r\n\r\n class Ingredient(models.Model):\r\n name = models.CharField(max_length=100)\r\n price = models.DecimalField(max_digits=4, decimal_places=2)\r\n\r\n class Pizza(models.Model):\r\n name = models.CharField(max_length=100)\r\n ingredients = models.ManyToManyField(Ingredient)\r\n\r\n @dbcache(models.DecimalField(max_digits=6, decimal_places=2,\r\n blank=True, null=True), invalidated_by=['myapp.Ingredient'])\r\n def get_price(self):\r\n return self.ingredients.aggregate(total=Sum('price'))['total'] or Decimal()\r\n\r\nEvery call to ``get_price`` would normally perform a database query to\r\ncalculate the total price of all ingredients. However, the ``dbcache``\r\ndecorator caused a new field to be added to the model: A ``DecimalField`` that\r\ncan store the resulting value of the ``get_price`` function, so it doesn't\r\nneed to perform the same query over and over again.\r\n\r\n\r\n.. |build-status| image:: https://secure.travis-ci.org/maykinmedia/django-dbcache-fields.svg?branch=master\r\n :alt: Build status\r\n :target: https://travis-ci.org/maykinmedia/django-dbcache-fields\r\n\r\n.. |coverage| image:: https://codecov.io/github/maykinmedia/django-dbcache-fields/coverage.svg?branch=master\r\n :target: https://codecov.io/github/maykinmedia/django-dbcache-fields?branch=master\r\n\r\n.. |lintly| image:: https://lintly.com/gh/maykinmedia/django-dbcache-fields/badge.svg\r\n :target: https://lintly.com/gh/maykinmedia/django-dbcache-fields/\r\n :alt: Lintly\r\n\r\n.. |license| image:: https://img.shields.io/pypi/l/django-dbcache-fields.svg\r\n :alt: BSD License\r\n :target: https://opensource.org/licenses/BSD-3-Clause\r\n\r\n.. |pyversion| image:: https://img.shields.io/pypi/pyversions/django-dbcache-fields.svg\r\n :alt: Supported Python versions\r\n :target: http://pypi.python.org/pypi/django-dbcache-fields/\r\n\r\n.. |djversion| image:: https://img.shields.io/badge/django-1.8%2C%201.9%2C%201.10%2C%201.11%2C%202.0-blue.svg\r\n :alt: Supported Django versions\r\n :target: http://pypi.python.org/pypi/django-dbcache-fields/\r\n\r\n\r\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/maykinmedia/django-dbcache-fields", "keywords": "django database cache methods decorator", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-dbcache-fields", "package_url": "https://pypi.org/project/django-dbcache-fields/", "platform": "any", "project_url": "https://pypi.org/project/django-dbcache-fields/", "project_urls": { "Homepage": "https://github.com/maykinmedia/django-dbcache-fields" }, "release_url": "https://pypi.org/project/django-dbcache-fields/0.9.2/", "requires_dist": [ "qualname (==0.1.0)" ], "requires_python": "", "summary": "Django DBCache Fields", "version": "0.9.2" }, "last_serial": 3427847, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "9fcfffa0be03db4b246826a60a797695", "sha256": "fb7583eb9dd2c9ef8f23dc3ace83763bd136899eee27365373e9ba74c1348cfd" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9fcfffa0be03db4b246826a60a797695", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10954, "upload_time": "2017-10-30T16:16:24", "url": "https://files.pythonhosted.org/packages/99/90/8811435da2d92a0de059bbdb6f4a5a2a14e19bcb8fe1e1f4086e5e773ae2/django_dbcache_fields-0.9.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d71c52f4e68fe7d57642b0ece299685c", "sha256": "090cb49d543efdc7cbce100f15fa73ff78b9421cf3043d9f8bc8883a97895b9d" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.0.tar.gz", "has_sig": false, "md5_digest": "d71c52f4e68fe7d57642b0ece299685c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17305, "upload_time": "2017-10-30T16:16:27", "url": "https://files.pythonhosted.org/packages/c3/0c/5b0df809bf1bdfbaa82ab881b7550bd7ef38a39e15c30b687070f494f9ad/django_dbcache_fields-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "71353b6f0796ef67aa66f27e017a0085", "sha256": "50d6c935589a9de1d7a923605dba0dc127960f7676fa320ada4e2fd50def4706" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "71353b6f0796ef67aa66f27e017a0085", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11592, "upload_time": "2017-11-01T17:31:03", "url": "https://files.pythonhosted.org/packages/06/d2/c0f11882b7ee366cf8a48a3b044318bc136216809db425856ffeb6e0cb80/django_dbcache_fields-0.9.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "16026f22709a4f57f1fa72e0df5d8c4b", "sha256": "0fd163d67d2b34a1b18e2e20563e7f7d82a0b4586c375b50dc050e21cc566003" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.1.tar.gz", "has_sig": false, "md5_digest": "16026f22709a4f57f1fa72e0df5d8c4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 709329, "upload_time": "2017-11-01T17:31:07", "url": "https://files.pythonhosted.org/packages/fe/20/fdbfe87147aab132cc7eb4c174752539fc6bc379afa0242d0ade99358be8/django_dbcache_fields-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "190a3c5696e97661492379217245ea39", "sha256": "8d09a6d75e0c8607d3344ae97979a76a2ffad2bfd1c3384f448f9fe0f7c8bb32" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "190a3c5696e97661492379217245ea39", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11674, "upload_time": "2017-12-19T10:15:08", "url": "https://files.pythonhosted.org/packages/8f/a2/6647a3f0b8af14d58802224d605bd672c89066030b02a138871c23385556/django_dbcache_fields-0.9.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cdb2e8f575fa33918a1b2e2d79f1bc42", "sha256": "f92c2b1e9125e498c62ddf53685cb55a28582317252425c78cb460ae00dc12b5" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.2.tar.gz", "has_sig": false, "md5_digest": "cdb2e8f575fa33918a1b2e2d79f1bc42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 709453, "upload_time": "2017-12-19T10:15:17", "url": "https://files.pythonhosted.org/packages/fb/65/dbb4bbdc21c4bc28716066ab50b8e7859943e66f19f38a3d9ffc7a5c20e2/django_dbcache_fields-0.9.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "190a3c5696e97661492379217245ea39", "sha256": "8d09a6d75e0c8607d3344ae97979a76a2ffad2bfd1c3384f448f9fe0f7c8bb32" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "190a3c5696e97661492379217245ea39", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 11674, "upload_time": "2017-12-19T10:15:08", "url": "https://files.pythonhosted.org/packages/8f/a2/6647a3f0b8af14d58802224d605bd672c89066030b02a138871c23385556/django_dbcache_fields-0.9.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cdb2e8f575fa33918a1b2e2d79f1bc42", "sha256": "f92c2b1e9125e498c62ddf53685cb55a28582317252425c78cb460ae00dc12b5" }, "downloads": -1, "filename": "django_dbcache_fields-0.9.2.tar.gz", "has_sig": false, "md5_digest": "cdb2e8f575fa33918a1b2e2d79f1bc42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 709453, "upload_time": "2017-12-19T10:15:17", "url": "https://files.pythonhosted.org/packages/fb/65/dbb4bbdc21c4bc28716066ab50b8e7859943e66f19f38a3d9ffc7a5c20e2/django_dbcache_fields-0.9.2.tar.gz" } ] }