how to avoid the `MediaCache` folder getting absol...
# help-with-umbraco
j
hey out there, we hit an interesting one today... one of our deployments to a vps running windows and iis locked up for nearly half an hour. when we dug into the logs of the devops pipeline, we noticed hundreds of thousands of entries looking like this:
Copy code
Deleting file (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2\d\4\3\c\2574.jpg).
Deleting file (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2\d\4\3\c\2574.meta).
Deleting directory (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2\d\4\3\c).
Deleting directory (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2\d\4\3).
Deleting directory (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2\d\4).
Deleting directory (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2\d).
Deleting directory (client-site\umbraco\Data\TEMP\MediaCache\0\0\0\2).
it turns out that at some point a hacking attempt had been run against the server and the
MediaCache
had grown to over 20gb of cache entries. the pipeline was recursively going into each folder and deleting them... we've just taken a look at https://docs.umbraco.com/umbraco-cms/v/13.latest-lts/reference/configuration/imagingsettings and we're going to use
CacheFolder
setting to move the folders/files to another location on disk so they don't get deleteded on a deployment. however we wanted to know more about the
CacheMaxAge
setting:
Copy code
Specifies how long a processed image may be used from the server cache before it needs to be re-processed again. The default is one year (365 days, formatted as a timespan).
does anyone know if this setting causes umbraco to clean up the files and folders? e.g. if a cache entry is found that's older than the specified timespan it physically removes the files/folders from disk?
d
As far as I know, Umbraco doesn't actively delete any files in the cache. I remember there was a package that would add a hash to your crop urls that would let you verify that this crop image comes from your own code, but I can't find it right now.
j
i hava feeling you maybe right... done quite a bit of digging both in the core and in imagesharp and i've yet to find anything that would actually delete cache items that are older than the
CacheMaxAge
setting.... interesting. this does mean that sites could be eating up disk and or blob storage space without people really realizing whats going on 🤔
38 Views