Class AWSS3StorageCache
Implements an AWS S3 Storage based cache.
Inherited Members
Namespace: SixLabors.ImageSharp.Web.Caching.AWS
Assembly: SixLabors.ImageSharp.Web.Providers.AWS.dll
Syntax
public class AWSS3StorageCache : IImageCache, IDisposable
Constructors
| Edit this page View SourceAWSS3StorageCache(IOptions<AWSS3StorageCacheOptions>, IServiceProvider)
Initializes a new instance of the AWSS3StorageCache class.
Declaration
public AWSS3StorageCache(IOptions<AWSS3StorageCacheOptions> cacheOptions, IServiceProvider serviceProvider)
Parameters
| Type | Name | Description |
|---|---|---|
| IOptions<AWSS3StorageCacheOptions> | cacheOptions | The cache options. |
| IServiceProvider | serviceProvider | The current service provider. |
Methods
| Edit this page View SourceCreateIfNotExists(AWSS3StorageCacheOptions, S3CannedACL)
Creates a new bucket under the specified account if a bucket with the same name does not already exist.
Declaration
public static PutBucketResponse? CreateIfNotExists(AWSS3StorageCacheOptions options, S3CannedACL acl)
Parameters
| Type | Name | Description |
|---|---|---|
| AWSS3StorageCacheOptions | options | The AWS S3 Storage cache options. |
| S3CannedACL | acl | Specifies whether data in the bucket may be accessed publicly and the level of access. PublicRead specifies full public read access for bucket and object data. Private specifies that the bucket data is private to the account owner. |
Returns
| Type | Description |
|---|---|
| PutBucketResponse | If the bucket does not already exist, a PutBucketResponse describing the newly created bucket. If the container already exists, null. |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Releases the unmanaged resources used by the AWSS3StorageCache and optionally releases the managed resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
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. |