List of available cache adaptors

Cache adaptors

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 xmlns:e="http://software.in2p3.fr/lavoisier/entries.xsd">
            <processor match="/e:entries/e:entry" type="InsertProcessor">
                <parameter name="nodes" eval="view_path_post('cache_0', choose(path(false()), path(false()), ''), match(), arguments())"/>
            </processor>
        </processors>
        <!-- cache with full generated XML -->
        <cache type="FileCache">
            <trigger type="ViewNotifiedTrigger"/>
        </cache>
    </view>
A set of triggering rules enables to trigger cache refresh. These rules are implements by trigger adaptors.

Notice: All the cache are disabled when using the lavoisier-standalone-execute command line interface


Caching a view with arguments

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:

  • either by the cache adaptor itself (for example the IndexedFileCache adaptor),
  • or by the post-processors (for example the default post-processor, which filters some XML events from cache output).

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 name="key" eval="path()"/>
            <parameter name="size">10</parameter>
        </connector>
    </view>

Cache triggers

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.