FindCache task#
A FindCache remembers which files a job has already seen, so that the next run only gets the new ones. It is for the case where a job fetches from a folder it may not tidy: a partner's outbox from which nothing may be deleted or moved.
Without it there are two ways to take each file once: delete or move it after fetching, or go by its date alone. The first needs rights you may not have; the second misses files with odd dates. The cache needs neither.
Fields#
| Field | What it does |
|---|---|
| Cache Name | the name of this memory. The Find names the same cache. It is also the name of the file the memory is kept in. |
| Path to store cache file | a folder for that file. Browse, Test. |
| Mode: Read / Write | Read loads what is remembered. Write saves it, with what this run added. |
How it is used#
A job with a cache has four steps:
| Task | Does |
|---|---|
FindCache, mode Read, name partner |
loads the list of files that were seen before. No file yet: an empty memory. |
Find, with FindCache name to use partner |
lists the folder, leaves out everything the cache knows, and notes what it hands on |
| Copy, or whatever the job does | works on the new files |
FindCache, mode Write, name partner |
saves the list |
Start → FindCache (Read) → Find → Copy → FindCache (Write) → End.
Nothing is remembered until the Write is reached. A run that fails before it, and stops, leaves the memory as it was: the next run finds the same files again. That is the safe way round.
When a file counts as known#
A file is left out when the cache holds a file with the same name and path and the same date of last change. So:
- a file that was replaced by a newer one under the same name is found again;
- a file that was only looked at is not.
A cache whose name ends in _SIZE also accepts the same size in place of the same date. Use such a name for a server that changes the dates of its files without changing the files.
Files that the cache remembers and that are no longer in the folder are dropped from the cache, so it does not grow for ever.
What it hands on#
The items it was given, unchanged. The cache is kept beside the run, not on the list.
Things to know#
- A failure after the files were handled. If the Copy worked and a later task fails with the job stopping there, the Write is not reached and the files are fetched again next time. Put the Write directly behind the task that matters, before the tasks that only report.
- The Find's filter still applies. The cache only takes away; it never adds.
- One cache per folder. Two jobs that fetch from two folders use two names.
- To fetch everything again, delete the cache's file. The next run starts with an empty memory.
- Large folders. A cache of a million files is read and written piece by piece and does not have to fit into memory: see Jobs with a million items.
- Find deleted items on the Find turns the cache round: it reports what was there and is gone. See Find.