Cache adaptors asynchronously build a cache of the full data view, in order to make the data view available faster and more reliably.
Since it is asynchronously built, a cached view can not have arguments. However, if all the possible argument values are known, then your can build a big data view containing all the XML documents generated for each value:
<view name="cache"> <!-- list of argument values --> <connector type="XMLConnector"> <parameter name="content"> <entry>value 1</entry> <entry>value 2</entry> </parameter> </connector> <processors> <insert match="/e:entries/e:entry"> <!-- XML generated for current argument value --> <connector type="StringConnector"> <parameter name="content" eval="parent_match()/text()"></parameter> </connector> </insert> </processors> <!-- cache with full generated XML --> <cache type="FileCache"> <trigger type="ViewNotifiedTrigger"></trigger> </cache> </view>
Notice:All the cache are disabled when using the lavoisier-standalone-execute command line interface |
Using <cache> is not allowed in a view wit arguments. The only situation where you can sent a path to a cached view is when this path is not needed to build the data view, and when this path is used:
When you want to cache a view with arguments, you should rather use the RotationCacheConnector. This plug-in implements a cache mechanism, but it is declared and used as a connector (i.e. synchronously). It just keep the most recently built data views with associated parameters, in order to give them faster on next calls.
Example:
<view name="cache_with_args"> <connector type="RotatingCacheConnector"> <parameter name="content" eval="view_path('get_file',path())"></parameter> <parameter name="key" eval="path()"></parameter> <parameter name="size">10</parameter> </connector> </view>
Since the cache of a data view is refreshed asynchronously, it must declare one or several cache trigger adaptors.
The cache refresh is triggered as soon as the condition of any of the declared trigger is matched. In other words, the list of declared triggers is equivalent to a boolean OR expression.
If cache refresh is triggered before the end of the period specified by attribute "ignore-during" (default is 1 second), then it is ignored.