pyramid_dogpile_cache2


Namepyramid_dogpile_cache2 JSON
Version 1.2.0 PyPI version JSON
download
home_pageNone
SummaryIntegrates dogpile.cache for Pyramid
upload_time2025-08-29 11:50:49
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseBSD-3-Clause
keywords dogpile.cache pyramid
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ======================
pyramid_dogpile_cache2
======================

Small `dogpile.cache`_ configuration and access package. It is inspired by
`pyramid_dogpile_cache`_, which we found unusable since it insists on
configuring the cache regions in its ``get_region()`` API -- but if you want to
use the ``@cache_on_arguments`` decorator, that is at **import time**, where no
configuration exists yet. Our package wants to perform the configuration during
the WSGI application setup instead.

This package is compatible with Python version >=3.6.

.. _`dogpile.cache`: https://python.org/project/dogpile-cache/
.. _`pyramid_dogpile_cache`: https://pypi.org/project/pyramid-dogpile-cache/


Usage
=====

The package offers only one API function; it returns a dogpile.cache
``CacheRegion``::

    from pyramid_dogpile_cache import get_region
    region = get_region('foo')

As said above, this is safe to call at import time, so you can go on like this::

    @region.cache_on_arguments()
    def expensive_function(one, two, three):
        # compute stuff


Setup / Pyramid
===============

Include the package, either in code::

    config = Configurator(...)
    config.include('pyramid_dogpile_cache2')

or in the ini file::

    pyramid.includes = pyramid_dogpile_cache2


Setup / Paste
=============

For non-Pyramid WSGI applications that use a paste.ini file, you need to call::

    def my_paste_app_factory(global_conf, **local_conf):
        pyramid_dogpile_cache2.configure_dogpile_cache(local_conf)
        return my_wsgi_callable


Settings
========

The settings support of pyramid_dogpile_cache unfortunately is quite incomplete
(e.g. it does not even convert ``expiration_time`` to ``int``). The support of
this packages is a little better, but still very much incomplete: we support
the in-memory and memcached backends (pylibmc to be precise), and only the same
backend and configuration for all cache regions.

The following settings are supported:

``dogpile_cache.regions``

    A list of region names that should be configured (separated by either
    spaces or commas).

``dogpile_cache.backend``

    The default backend for cache regions (e.g. ``'dogpile.cache.memory'``,
    ``dogpile.cache.pylibmc``, etc.).

``dogpile_cache.REGION.backend``

   Backend for the given region.

``dogpile_cache.expiration_time``

    The default expiration time. Can be overridden for individual regions (in
    seconds). Omit to set no expiration.

``dogpile_cache.REGION.expiration_time``

    The expiration time for the given cache region (in seconds).
    If omitted, uses the global expiration_time setting.

``dogpile_cache.arguments.*``

    Defaults for backend arguments. Can be overridden for individual regions.

``dogpile_cache.REGION.arguments.*``

    Backend arguments for the given cache region.

Backend arguments work only for strings, thus we support some custom treatment:

``dogpile_cache.pylibmc_url``

    A list of memcached servers, separated by ``;``.

``dogpile_cache.pylibmc_behavior.*``

    Set `pylibmc behaviours`_, see `pylibmc convert`_ for which
    subkeys are supported.


.. _`pylibmc behaviours`: http://sendapatch.se/projects/pylibmc/behaviors.html
.. _`pylibmc convert`: https://github.com/ZeitOnline/pyramid_dogpile_cache2/blob/main/src/pyramid_dogpile_cache2/pylibmc.py

Note: As opposed to pyramid_dogpile_cache we don't support overriding the
key_generator or key_mangler functions yet; we preconfigure them with enhanced
versions of dogpile.cache that support non-ascii function arguments and
generating cache keys for methods that include the class name.


=====================================
Developing pyramid_dogpile_cache2
=====================================

:Author:
    `Die ZEIT Engineering Online <zon-backend@zeit.de>`_

:PyPI page:
    https://pypi.org/project/pyramid-dogpile-cache2/

:Issues:
    `report by e-mail <zon-backend@zeit.de>`_

:Source code:
    https://github.com/zeitonline/pyramid_dogpile_cache2

:Current change log:
    https://github.com/zeitonline/pyramid_dogpile_cache2/blob/main/CHANGES.txt


=====================================
Change log for pyramid_dogpile_cache2
=====================================

.. towncrier release notes start

1.2.0 (2025-08-29)
==================




- Vendor pylibmc parsing code after beaker removed it in 1.14 (beaker)


1.1.2 (2022-07-15)
==================

- Clear internal `_actual_backend` during configure,
  to improve test isolation


1.1.1 (2020-09-11)
==================

- Ignore empty `pylibmc_url` setting


1.1.0 (2020-07-28)
==================

- Drop Python-2 compatibility, update to dogpile.cache>=1.0


1.0.6 (2019-11-08)
==================

- Allow configuring no expiration time at all


1.0.5 (2018-12-14)
==================

- Clarify Python-3 compatiblity (it's >=3.4, not _just_ 3.4)


1.0.4 (2018-11-21)
==================

- Support caching functions with type annotations on Python 3
  (see PR #5).


1.0.3 (2017-02-14)
==================

- Fix packaging issue (see PR #2).


1.0.2 (2016-08-01)
==================

- Update API compatibility to dogpile.cache-0.6.0.


1.0.1 (2016-01-20)
==================

- Actually include the class name in the cache key for methods.


1.0.0 (2016-01-19)
==================

- Initial release.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyramid_dogpile_cache2",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "dogpile.cache, pyramid",
    "author": null,
    "author_email": "DIE ZEIT <engineering@zeit.de>",
    "download_url": "https://files.pythonhosted.org/packages/f3/15/577c316877ba9a0592835b57228ff2ace8d5288d3e6f7f630d7e8802fb54/pyramid_dogpile_cache2-1.2.0.tar.gz",
    "platform": null,
    "description": "======================\npyramid_dogpile_cache2\n======================\n\nSmall `dogpile.cache`_ configuration and access package. It is inspired by\n`pyramid_dogpile_cache`_, which we found unusable since it insists on\nconfiguring the cache regions in its ``get_region()`` API -- but if you want to\nuse the ``@cache_on_arguments`` decorator, that is at **import time**, where no\nconfiguration exists yet. Our package wants to perform the configuration during\nthe WSGI application setup instead.\n\nThis package is compatible with Python version >=3.6.\n\n.. _`dogpile.cache`: https://python.org/project/dogpile-cache/\n.. _`pyramid_dogpile_cache`: https://pypi.org/project/pyramid-dogpile-cache/\n\n\nUsage\n=====\n\nThe package offers only one API function; it returns a dogpile.cache\n``CacheRegion``::\n\n    from pyramid_dogpile_cache import get_region\n    region = get_region('foo')\n\nAs said above, this is safe to call at import time, so you can go on like this::\n\n    @region.cache_on_arguments()\n    def expensive_function(one, two, three):\n        # compute stuff\n\n\nSetup / Pyramid\n===============\n\nInclude the package, either in code::\n\n    config = Configurator(...)\n    config.include('pyramid_dogpile_cache2')\n\nor in the ini file::\n\n    pyramid.includes = pyramid_dogpile_cache2\n\n\nSetup / Paste\n=============\n\nFor non-Pyramid WSGI applications that use a paste.ini file, you need to call::\n\n    def my_paste_app_factory(global_conf, **local_conf):\n        pyramid_dogpile_cache2.configure_dogpile_cache(local_conf)\n        return my_wsgi_callable\n\n\nSettings\n========\n\nThe settings support of pyramid_dogpile_cache unfortunately is quite incomplete\n(e.g. it does not even convert ``expiration_time`` to ``int``). The support of\nthis packages is a little better, but still very much incomplete: we support\nthe in-memory and memcached backends (pylibmc to be precise), and only the same\nbackend and configuration for all cache regions.\n\nThe following settings are supported:\n\n``dogpile_cache.regions``\n\n    A list of region names that should be configured (separated by either\n    spaces or commas).\n\n``dogpile_cache.backend``\n\n    The default backend for cache regions (e.g. ``'dogpile.cache.memory'``,\n    ``dogpile.cache.pylibmc``, etc.).\n\n``dogpile_cache.REGION.backend``\n\n   Backend for the given region.\n\n``dogpile_cache.expiration_time``\n\n    The default expiration time. Can be overridden for individual regions (in\n    seconds). Omit to set no expiration.\n\n``dogpile_cache.REGION.expiration_time``\n\n    The expiration time for the given cache region (in seconds).\n    If omitted, uses the global expiration_time setting.\n\n``dogpile_cache.arguments.*``\n\n    Defaults for backend arguments. Can be overridden for individual regions.\n\n``dogpile_cache.REGION.arguments.*``\n\n    Backend arguments for the given cache region.\n\nBackend arguments work only for strings, thus we support some custom treatment:\n\n``dogpile_cache.pylibmc_url``\n\n    A list of memcached servers, separated by ``;``.\n\n``dogpile_cache.pylibmc_behavior.*``\n\n    Set `pylibmc behaviours`_, see `pylibmc convert`_ for which\n    subkeys are supported.\n\n\n.. _`pylibmc behaviours`: http://sendapatch.se/projects/pylibmc/behaviors.html\n.. _`pylibmc convert`: https://github.com/ZeitOnline/pyramid_dogpile_cache2/blob/main/src/pyramid_dogpile_cache2/pylibmc.py\n\nNote: As opposed to pyramid_dogpile_cache we don't support overriding the\nkey_generator or key_mangler functions yet; we preconfigure them with enhanced\nversions of dogpile.cache that support non-ascii function arguments and\ngenerating cache keys for methods that include the class name.\n\n\n=====================================\nDeveloping pyramid_dogpile_cache2\n=====================================\n\n:Author:\n    `Die ZEIT Engineering Online <zon-backend@zeit.de>`_\n\n:PyPI page:\n    https://pypi.org/project/pyramid-dogpile-cache2/\n\n:Issues:\n    `report by e-mail <zon-backend@zeit.de>`_\n\n:Source code:\n    https://github.com/zeitonline/pyramid_dogpile_cache2\n\n:Current change log:\n    https://github.com/zeitonline/pyramid_dogpile_cache2/blob/main/CHANGES.txt\n\n\n=====================================\nChange log for pyramid_dogpile_cache2\n=====================================\n\n.. towncrier release notes start\n\n1.2.0 (2025-08-29)\n==================\n\n\n\n\n- Vendor pylibmc parsing code after beaker removed it in 1.14 (beaker)\n\n\n1.1.2 (2022-07-15)\n==================\n\n- Clear internal `_actual_backend` during configure,\n  to improve test isolation\n\n\n1.1.1 (2020-09-11)\n==================\n\n- Ignore empty `pylibmc_url` setting\n\n\n1.1.0 (2020-07-28)\n==================\n\n- Drop Python-2 compatibility, update to dogpile.cache>=1.0\n\n\n1.0.6 (2019-11-08)\n==================\n\n- Allow configuring no expiration time at all\n\n\n1.0.5 (2018-12-14)\n==================\n\n- Clarify Python-3 compatiblity (it's >=3.4, not _just_ 3.4)\n\n\n1.0.4 (2018-11-21)\n==================\n\n- Support caching functions with type annotations on Python 3\n  (see PR #5).\n\n\n1.0.3 (2017-02-14)\n==================\n\n- Fix packaging issue (see PR #2).\n\n\n1.0.2 (2016-08-01)\n==================\n\n- Update API compatibility to dogpile.cache-0.6.0.\n\n\n1.0.1 (2016-01-20)\n==================\n\n- Actually include the class name in the cache key for methods.\n\n\n1.0.0 (2016-01-19)\n==================\n\n- Initial release.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Integrates dogpile.cache for Pyramid",
    "version": "1.2.0",
    "project_urls": {
        "repository": "https://github.com/zeitonline/pyramid_dogpile_cache2"
    },
    "split_keywords": [
        "dogpile.cache",
        " pyramid"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3d39d29c06f75267e5997cacaf824ddf2c100bb95b6347425c34660860d5d218",
                "md5": "52ef97821c9ab5258d800f774f474411",
                "sha256": "38895adf1fb96d3c51f03ef4d5ac9698121084246829fd501baa73812008c8b3"
            },
            "downloads": -1,
            "filename": "pyramid_dogpile_cache2-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "52ef97821c9ab5258d800f774f474411",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10708,
            "upload_time": "2025-08-29T11:50:48",
            "upload_time_iso_8601": "2025-08-29T11:50:48.260093Z",
            "url": "https://files.pythonhosted.org/packages/3d/39/d29c06f75267e5997cacaf824ddf2c100bb95b6347425c34660860d5d218/pyramid_dogpile_cache2-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f315577c316877ba9a0592835b57228ff2ace8d5288d3e6f7f630d7e8802fb54",
                "md5": "cb27619245b5ef41b2b0f171bd0f1198",
                "sha256": "9e65f64b50ad2ea7a6f50efc59e588c6fd134e2d2fe2f42f06744957ebdac7d1"
            },
            "downloads": -1,
            "filename": "pyramid_dogpile_cache2-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cb27619245b5ef41b2b0f171bd0f1198",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 47418,
            "upload_time": "2025-08-29T11:50:49",
            "upload_time_iso_8601": "2025-08-29T11:50:49.635342Z",
            "url": "https://files.pythonhosted.org/packages/f3/15/577c316877ba9a0592835b57228ff2ace8d5288d3e6f7f630d7e8802fb54/pyramid_dogpile_cache2-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-29 11:50:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zeitonline",
    "github_project": "pyramid_dogpile_cache2",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "lcname": "pyramid_dogpile_cache2"
}
        
Elapsed time: 0.53853s