TOC PREV NEXT INDEX

cache function

Synopsis

cache_(expression)

cache instructs AVS/Express to cache the result of the enclosed expression, so that the expression is recalculated only if the objects referenced in the expression have changed.

When an object is connected to an expression, AVS/Express by default recomputes an expression whenever the object's value is requested.

Caching involves a trade-off between the time required to recalculate an expression and the space required to cache the result.

For example, you define a group whose method creates a large array of float data, stored in subobject out. You also define an object called max and connect it to the maximum value in out:

group create_data {
float+write out[];
method_upd func = "create_data";
};
float max => max_array(out);

By default, every time you request max's value, AVS/Express recalculates the expression, even if out has not changed. To prevent this, use the cache function:

float max => cache(max_array(out));


The cache function caches the result of an expression so that it is recomputed only when objects referenced by the expression have changed.

Input Ports

None


TOC PREV NEXT INDEX