Method and property caching decorators


Keywords
persistent caching decorator method property
License
ZPL-2.1
Install
pip install zope.cachedescriptors==4.3.1

Documentation

zope.cachedescriptors

Latest release Supported Python versions https://travis-ci.org/zopefoundation/zope.cachedescriptors.svg?branch=master Documentation Status https://coveralls.io/repos/github/zopefoundation/zope.cachedescriptors/badge.svg?branch=master

Cached descriptors cache their output. They take into account instance attributes that they depend on, so when the instance attributes change, the descriptors will change the values they return.

Cached descriptors cache their data in _v_ attributes, so they are also useful for managing the computation of volatile attributes for persistent objects.

Persistent descriptors:

  • property

    A simple computed property.

    See src/zope/cachedescriptors/property.rst.

  • method

    Idempotent method. The return values are cached based on method arguments and on any instance attributes that the methods are defined to depend on.

    Note

    Only a cache based on arguments has been implemented so far.

    See src/zope/cachedescriptors/method.rst.