Class AzureBlobStorageCache
Implements an Azure Blob Storage based cache.
Implements
Inherited Members
Namespace: SixLabors.ImageSharp.Web.Caching.Azure
Assembly: SixLabors.ImageSharp.Web.Providers.Azure.dll
Syntax
public class AzureBlobStorageCache : IImageCache
Constructors
| Edit this page View SourceAzureBlobStorageCache(IOptions<AzureBlobStorageCacheOptions>)
Initializes a new instance of the AzureBlobStorageCache class.
Declaration
public AzureBlobStorageCache(IOptions<AzureBlobStorageCacheOptions> cacheOptions)
Parameters
Type | Name | Description |
---|---|---|
IOptions<AzureBlobStorageCacheOptions> | cacheOptions | The cache options. |
Methods
| Edit this page View SourceCreateIfNotExists(AzureBlobStorageCacheOptions, PublicAccessType)
Creates a new container under the specified account if a container with the same name does not already exist.
Declaration
public static Response<BlobContainerInfo> CreateIfNotExists(AzureBlobStorageCacheOptions options, PublicAccessType accessType)
Parameters
Type | Name | Description |
---|---|---|
AzureBlobStorageCacheOptions | options | The Azure Blob Storage cache options. |
PublicAccessType | accessType | Optionally specifies whether data in the container may be accessed publicly and the level of access. BlobContainer specifies full public read access for container and blob data. Clients can enumerate blobs within the container via anonymous request, but cannot enumerate containers within the storage account. Blob specifies public read access for blobs. Blob data within this container can be read via anonymous request, but container data is not available. Clients cannot enumerate blobs within the container via anonymous request. None specifies that the container data is private to the account owner. |
Returns
Type | Description |
---|---|
Response<BlobContainerInfo> | If the container does not already exist, a Response<T> describing the newly created container. If the container already exists, null. |
GetAsync(string)
Gets the image resolver associated with the specified key.
Declaration
public Task<IImageCacheResolver?> GetAsync(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The cache key. |
Returns
Type | Description |
---|---|
Task<IImageCacheResolver> | The IImageResolver. |
SetAsync(string, Stream, ImageCacheMetadata)
Sets the value associated with the specified key.
Declaration
public Task SetAsync(string key, Stream stream, ImageCacheMetadata metadata)
Parameters
Type | Name | Description |
---|---|---|
string | key | The cache key. |
Stream | stream | The stream containing the image to store. |
ImageCacheMetadata | metadata | The ImageCacheMetadata associated with the image to store. |
Returns
Type | Description |
---|---|
Task | The task. |