Farhad Zamani
Farhad Zamani

Reputation: 5861

When Imageflow does remove cached images

I use the Imageflow package for resizing image in asp.net core.

it cache the images in imageflow_cache folder. But I don't know when cached images are deleted?

This is my configuration:

builder
    .Services
    .AddImageflowHybridCache(new HybridCacheOptions(Path.Combine(builder.Environment.WebRootPath, 
                                                                 "imageflow_cache"))
{
    CacheSizeLimitInBytes = (long)1 * 1024 * 1024 * 1024 //1 GiB
});

When cached images are delete in imageflow_cache folder?

Can I set a time for deleting cached images?

Upvotes: 1

Views: 202

Answers (1)

Jason Pan
Jason Pan

Reputation: 22114

I read the source code and found CleanupStrategy.

I haven't the resources like you,So I according the source code and write code snipt below, you can refer it, if some properties not found, try to F12 and find it or share with us. Hope the code useful to you.

builder.Services.AddImageflowHybridCache(new HybridCacheOptions(Path.Combine(builder.Environment.WebRootPath, "imageflow_cache"))
{
    CacheSizeLimitInBytes = (long)1 * 1024 * 1024 * 1024, //1 GiB
    AutoClean = true,
    CleanupStrategy = "d.01:00:00" // delete files older than 1 day
});

Upvotes: 2

Related Questions