Table of Contents

Struct ImageCacheMetadata

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

Represents the metadata associated with an image file.

public readonly struct ImageCacheMetadata : IEquatable<ImageCacheMetadata>
Implements
Inherited Members

Constructors

ImageCacheMetadata(DateTime, DateTime, string, TimeSpan, long)

Initializes a new instance of the ImageCacheMetadata struct.

public ImageCacheMetadata(DateTime sourceLastWriteTimeUtc, DateTime cacheLastWriteTimeUtc, string contentType, TimeSpan cacheControlMaxAge, long contentLength)

Parameters

sourceLastWriteTimeUtc DateTime

The date and time in coordinated universal time (UTC) since the source file was last modified.

cacheLastWriteTimeUtc DateTime

The date and time in coordinated universal time (UTC) since the cache file was last modified.

contentType string

The content type for the source file.

cacheControlMaxAge TimeSpan

The maximum amount of time a resource will be considered fresh.

contentLength long

The length of the image in bytes.

Properties

CacheControlMaxAge

Gets the maximum amount of time a resource will be considered fresh.

public TimeSpan CacheControlMaxAge { get; }

Property Value

TimeSpan

CacheLastWriteTimeUtc

Gets the date and time in coordinated universal time (UTC) since the cached file was last modified.

public DateTime CacheLastWriteTimeUtc { get; }

Property Value

DateTime

ContentLength

Gets the length of the image in bytes.

public long ContentLength { get; }

Property Value

long

ContentType

Gets the content type of the source file.

public string ContentType { get; }

Property Value

string

SourceLastWriteTimeUtc

Gets the date and time in coordinated universal time (UTC) since the source file was last modified.

public DateTime SourceLastWriteTimeUtc { get; }

Property Value

DateTime

Methods

Equals(ImageCacheMetadata)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(ImageCacheMetadata other)

Parameters

other ImageCacheMetadata

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

FromDictionary(IDictionary<string, string>)

Returns a new ImageCacheMetadata parsed from the given dictionary.

public static ImageCacheMetadata FromDictionary(IDictionary<string, string> dictionary)

Parameters

dictionary IDictionary<string, string>

The dictionary to parse and return the metadata from.

Returns

ImageCacheMetadata

The ImageCacheMetadata.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

ReadAsync(Stream)

Asynchronously reads and returns an ImageCacheMetadata from the input stream.

public static Task<ImageCacheMetadata> ReadAsync(Stream stream)

Parameters

stream Stream

The input stream.

Returns

Task<ImageCacheMetadata>

The ImageCacheMetadata.

ToDictionary()

Returns a new Dictionary<TKey, TValue> representing the current instance.

public Dictionary<string, string> ToDictionary()

Returns

Dictionary<string, string>

The Dictionary<TKey, TValue>.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

WriteAsync(Stream)

Asynchronously writes the metadata to the target stream.

public Task WriteAsync(Stream stream)

Parameters

stream Stream

The target stream.

Returns

Task

A Task representing the asynchronous operation.

Operators

operator ==(in ImageCacheMetadata, in ImageCacheMetadata)

Compares two ImageCacheMetadata objects for equality.

public static bool operator ==(in ImageCacheMetadata left, in ImageCacheMetadata right)

Parameters

left ImageCacheMetadata

The ImageCacheMetadata on the left side of the operand.

right ImageCacheMetadata

The ImageCacheMetadata on the right side of the operand.

Returns

bool

True if the current left is equal to the right parameter; otherwise, false.

operator !=(in ImageCacheMetadata, in ImageCacheMetadata)

Compares two ImageCacheMetadata objects for inequality.

public static bool operator !=(in ImageCacheMetadata left, in ImageCacheMetadata right)

Parameters

left ImageCacheMetadata

The ImageCacheMetadata on the left side of the operand.

right ImageCacheMetadata

The ImageCacheMetadata on the right side of the operand.

Returns

bool

True if the current left is unequal to the right parameter; otherwise, false.