OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.45k stars 2.41k forks source link

Media file store cache management #4950

Open TFleury opened 4 years ago

TFleury commented 4 years ago

When the DefaultMediaFileStoreCacheFileProvider is enabled (with Azure Media Storage) all accessed media are stored in 'ms-cache' directory.

It's very efficient for performance, but I see some issues here :

Shouldn't we use IDistributedCache for that ? Probably with a maxFileSize above which the file is not cached but served directly from IMediaFileStore.

Skrypt commented 4 years ago

//cc @deanmarcussen

sebastienros commented 4 years ago

When this feature was designed we realized these limitations, and postponed these on purpose for when we would find some time to improve it. So definitely a yes to find solution to these issues.

The IDistributedCache is not a valid solution IMO as it will just move the static files in memory (even if it's stored on redis for instance). The goal here is to use the fastest way to serve the content by using the FS.

I think we talked that we could just define more options in the feature with disk quotas, and a background task to ensure the quotas are respected. And also create an handler interface when files are updated/removed such that this feature could also remove the file from the cache.

This should not be hard to implement.

deanmarcussen commented 4 years ago

Yes, also agree that there are more improvements that can be done to reduce the limitations.

Here's a few thoughts on the limitations mentioned, plus a couple of others.

If you're working on this @TFleury happy to help with anything, ping me on gitter or here