Caching: implementation details¶
This section covers some details of the caching mechanism which are not discussed in the user guide. If you are developing a plugin and want to modify the caching behavior of your classes, we recommend you read this section first.
Disabling caching for WorkCalculation
¶
As discussed in the user guide, nodes which can have RETURN
links cannot be cached. This is enforced on two levels:
- The
_cacheable
property is set toFalse
in theAbstractCalculation
, and only re-enabled inAbstractJobCalculation
andInlineCalculation
. This means that aWorkCalculation
will not be cached. - The
_store_from_cache
method, which is used to “clone” an existing node, will raise an error if the existing node has anyRETURN
links. This extra safe-guard prevents cases where a user might incorrectly override the_cacheable
property on aWorkCalculation
subclass.