Table of Contents

Class PhysicalFileSystemCache

Namespace
SixLabors.ImageSharp.Web.Caching
Assembly
SixLabors.ImageSharp.Web.dll

Implements a physical file system based cache.

public class PhysicalFileSystemCache : IImageCache
Inheritance
PhysicalFileSystemCache
Implements
Inherited Members

Constructors

PhysicalFileSystemCache(IOptions<PhysicalFileSystemCacheOptions>, IWebHostEnvironment, FormatUtilities)

Initializes a new instance of the PhysicalFileSystemCache class.

public PhysicalFileSystemCache(IOptions<PhysicalFileSystemCacheOptions> options, IWebHostEnvironment environment, FormatUtilities formatUtilities)

Parameters

options IOptions<PhysicalFileSystemCacheOptions>

The cache configuration options.

environment IWebHostEnvironment

The hosting environment the application is running in.

formatUtilities FormatUtilities

Contains various format helper methods based on the current configuration.

Methods

GetAsync(string)

Gets the image resolver associated with the specified key.

public Task<IImageCacheResolver?> GetAsync(string key)

Parameters

key string

The cache key.

Returns

Task<IImageCacheResolver>

The IImageResolver.

SetAsync(string, Stream, ImageCacheMetadata)

Sets the value associated with the specified key.

public Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata)

Parameters

key string

The cache key.

stream Stream

The stream containing the image to store.

metadata ImageCacheMetadata

The ImageCacheMetadata associated with the image to store.

Returns

Task

The task.