<cache>
Purpose/Function
Assigns a Trebuchet cache object to the environment.
A cache object can be obtained in three ways:
- from a CacheBasedOperation (read-only);
- from a cache file;
- created from a header.
In the latter case, one or more of the URIs must be set. If a pattern or configuration is given, these will be included in the header.
Attributes
NAME |
TYPE |
DEFAULT VALUE |
DESCRIPTION |
---|---|---|---|
copyCache |
|
false |
if true, file contents are those of a copy cache; else, contents are of a list cache |
file |
|
|
from which to create the cache object |
operation |
|
|
dereferenced operation from which to create a read-only instance of its cache |
readOnly |
|
true |
if the cache is created from a pre-existent file, make it a read-only instance |
sourceBaseUri |
|
|
to be included in the header of the cache to be constructed |
tmpDir |
|
|
to be included in the header of the cache to be constructed |
targetUri |
|
|
to be included in the header of the cache to be constructed |
NOTE: Although programmatic use of the Trebuchet libraries allows one to access the cache of an operation while it is in progress, Ogrescript limits this access to completed operations. Be sure to set "cleanup" on the operation to false in this case, as illustrated below.
Elements
TAG |
TYPE |
COUNT |
DESCRIPTION |
---|---|---|---|
|
|
0:1 |
configuration to be included in the header of the cache to be constructed |
|
|
0:1 |
pattern to be included in the header of the cache to be constructed |
ReturnValues
DEFAULT NAME |
TYPE |
---|---|
cache |
|
Examples
<ogrescript> <declare name="cache"/> <declare name="op"/> <copy cleanup="false"> <source-dir>file:/tmp/dir0</source-dir> <target>file:/tmp/dir1</target> <return-value assignedName="op" defaultName="copy"/> </copy> <cache operation="${op}"> <return-value defaultName="cache"/> </cache> ... <delete-cache cache="${cache}"/> </ogrescript> <ogrescript> <declare name="cache"/> <cache copyCache="true" file="/tmp/trebuchet/cache_1082888432532.332" readOnly="false"> <return-value defaultName="cache"/> </cache> ... <delete-cache cache="${cache}"/> </ogrescript> <ogrescript> <declare name="cache"/> <cache sourceBaseUri="file:/tmp/dir0"> <pattern base="file:/tmp/dir0"> <include>file-1*/**</include> </pattern> <configuration> <property name="list-recursive" value="true" type="boolean"/> </configuration> <return-value defaultName="cache"/> </cache> ... <delete-cache cache="${cache}"/> </ogrescript>