How to immediately cause eviction for Item upon creation?

I am developing a FileProvider extension on Mac. I was wondering what the most reliable way to evict a document as soon as possible after createItem is called for the respective item.

Our use-case for this is as follows: Users can 'bulk-import' items into a FileProvider folder, and we want our application to immediately evict the item as soon as possible once the item's content is uploaded to the server. This is to save space on the user's machine.

So, what is the best way to accomplish immediate eviction after item creation? I've tried calling evictItem from within the createItem function itself, but that yields many errors and can cause slowness.

Have you tried setting contentPolicy to downloadLazilyAndEvictOnRemoteUpdate and then triggering signalChange on the folder ( for the evict on remote update ) when all uploads are complete ?

You should not need to do this. FileProvider marks uploaded files as evictable in APFS, and the system will automatically evict eligible items upon low disk pressure.

Additionally, many parts of the system will not consider evictable files to count as “used” disk space, since the space may easily be reclaimed by the system.

If you find parts of the system, or 3rd party apps, which are considering evictable files to count as “used” disk space, you should file a Feedback for that, so those can be corrected.

Ok, that solves the space issue. However, with our application/product, we prefer to 'dehydrate', or evict, documents for security reasons as well. We have an encrypted store of the document locally for when the user wishes to work on the document again. Our customers, who are primarily in the legal space, prefer that documents are evicted ASAP if not being actively worked on so that content remains safely in the encrypted store rather than exposed out in the open. How do you recommend going about this ?

How to immediately cause eviction for Item upon creation?
 
 
Q