Caching for rendered files

Hi, just wanted to know how long the rendered files are cached and the same is returned to user instead of re rendering them?

following setting has been included to locate file path.
.AddLocalCache(“./GroupDocsCache”);

But it doesn’t have anything that specifies duration, so not able to find how long those are cached.

@sachinerande

Yes, the implementation does not support expiration, so the files are stored till you remove them. File expiration can be managed outside the application for a specific folder where you store the files, as an example you can create File Expiration Task on Windows Server. Cloud storages like S3 and Azure Blob Storage supports expiration.

Thanks @vladimir.litvinchik

for an example if I have “A.pdf” with jpg viewer configured. If it got rendered first time, for all next requests for the same file cached images are returned.

Now - what happens if the “A.pdf” is updated in original source say blob or anything, does it render the updated pdf again or still returns earlier cached (may be recognized on file name alone and not modification date) ?
Just wanted to make sure if there is any mechanism to recognize if original file was updated for which cache is already loaded.

Looks like only file cache is supported does it support caching in blob container ?

@sachinerande

We do not have any checks for changes in files in the source storage. If the filename remains the same the cache will be used. See LocalFileCache.cs and LocalFileStorage.cs implementation for more details.

At the moment caching is not supported in blob container. You can add your own cache provider by implementing IFileCache interface and then register it in Program.cs e.g.

builder.Services.AddTransient<IFileCache, MyFileCache>();