Umbraco.Community.ImageSharp.TrimCache 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Umbraco.Community.ImageSharp.TrimCache --version 1.0.2
                    
NuGet\Install-Package Umbraco.Community.ImageSharp.TrimCache -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Umbraco.Community.ImageSharp.TrimCache" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Umbraco.Community.ImageSharp.TrimCache" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="Umbraco.Community.ImageSharp.TrimCache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Umbraco.Community.ImageSharp.TrimCache --version 1.0.2
                    
#r "nuget: Umbraco.Community.ImageSharp.TrimCache, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Umbraco.Community.ImageSharp.TrimCache@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Umbraco.Community.ImageSharp.TrimCache&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=Umbraco.Community.ImageSharp.TrimCache&version=1.0.2
                    
Install as a Cake Tool

Umbraco.Community.ImageSharp.TrimCache

Scheduled, age-based trimming of the ImageSharp.Web image cache for Umbraco. Supports both the Azure Blob cache and the local physical cache, and runs in the background as a hosted service.

The ImageSharp cache accumulates resized image variants that are never cleared automatically — on Umbraco Cloud (or any blob-backed site) it can grow until it exceeds the plan's media-storage limit. This package trims those variants by age, on a schedule. Deleting a variant is safe: it is simply regenerated from the original media on the next request. The trimmer only scans the cache location you configure, so keep that separate from source media — in Azure mode, point it at a cache-only container, never the media container.

Supports Umbraco 13, 17 and 18.

Installation

dotnet add package Umbraco.Community.ImageSharp.TrimCache

The hosted service is wired up automatically — no manual registration needed. By default it trims the local physical cache; if Azure blob storage is configured it trims the Azure cache instead.

Configuration

Add an ImageCacheTrim section to appsettings.json (defaults shown):

"ImageCacheTrim": {
  "Enabled": true,
  "Mode": "Auto",
  "MaxAgeDays": 30,
  "IntervalMinutes": 1440,
  "StartupDelayMinutes": 5,
  "CacheFolderPath": "",
  "ConnectionString": "",
  "ContainerName": "",
  "Prefix": ""
}
  • ModeAuto (default), Local or Azure.
  • MaxAgeDays — entries older than this are deleted (regenerated on next request).
  • IntervalMinutes — run frequency, measured from startup. Default 1440 (24h).
  • CacheFolderPath — local mode only; leave empty (the default) to follow Umbraco's configured ImageSharp cache folder (Umbraco:CMS:Imaging:Cache:CacheFolder).
  • ConnectionString — required for Azure mode. An account connection string, or one carrying a SAS (BlobEndpoint=…;SharedAccessSignature=…) — the SAS form is how Umbraco Cloud exposes storage. The credential must allow List and Delete.
  • Prefix — scopes the scan (e.g. cache/). Set it whenever the cache shares a container with other data (e.g. media): with an empty prefix the trimmer would delete the media too. Leave empty only for a dedicated cache-only container.
  • RunOnEveryServer — load-balancing control; defaults to running on every server for a local (per-server) cache and only the scheduling server for a shared Azure cache.

Umbraco Cloud: set Mode: "Azure", put the SAS connection string in ConnectionString (with ContainerName), and set Prefix to the cache subfolder (e.g. cache/) so media in the same container is never trimmed. See the project README for details.

See the project README for full documentation.

Author

Created and maintained by Justin Neville at Nevitech IT Solutions Ltd.

Credits

Icon: Cleanup icons created by Icon home - Flaticon

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 37 7/4/2026
1.0.2 48 7/2/2026
1.0.1 51 7/2/2026
1.0.0 47 7/2/2026