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
sourceLastWriteTimeUtcDateTimeThe date and time in coordinated universal time (UTC) since the source file was last modified.
cacheLastWriteTimeUtcDateTimeThe date and time in coordinated universal time (UTC) since the cache file was last modified.
contentTypestringThe content type for the source file.
cacheControlMaxAgeTimeSpanThe maximum amount of time a resource will be considered fresh.
contentLengthlongThe 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
CacheLastWriteTimeUtc
Gets the date and time in coordinated universal time (UTC) since the cached file was last modified.
public DateTime CacheLastWriteTimeUtc { get; }
Property Value
ContentLength
Gets the length of the image in bytes.
public long ContentLength { get; }
Property Value
ContentType
Gets the content type of the source file.
public string ContentType { get; }
Property Value
SourceLastWriteTimeUtc
Gets the date and time in coordinated universal time (UTC) since the source file was last modified.
public DateTime SourceLastWriteTimeUtc { get; }
Property Value
Methods
Equals(ImageCacheMetadata)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ImageCacheMetadata other)
Parameters
otherImageCacheMetadataAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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
dictionaryIDictionary<string, string>The dictionary to parse and return the metadata from.
Returns
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
streamStreamThe input stream.
Returns
ToDictionary()
Returns a new Dictionary<TKey, TValue> representing the current instance.
public Dictionary<string, string> ToDictionary()
Returns
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
streamStreamThe target stream.
Returns
Operators
operator ==(in ImageCacheMetadata, in ImageCacheMetadata)
Compares two ImageCacheMetadata objects for equality.
public static bool operator ==(in ImageCacheMetadata left, in ImageCacheMetadata right)
Parameters
leftImageCacheMetadataThe ImageCacheMetadata on the left side of the operand.
rightImageCacheMetadataThe ImageCacheMetadata on the right side of the operand.
Returns
- bool
True if the current left is equal to the
rightparameter; otherwise, false.
operator !=(in ImageCacheMetadata, in ImageCacheMetadata)
Compares two ImageCacheMetadata objects for inequality.
public static bool operator !=(in ImageCacheMetadata left, in ImageCacheMetadata right)
Parameters
leftImageCacheMetadataThe ImageCacheMetadata on the left side of the operand.
rightImageCacheMetadataThe ImageCacheMetadata on the right side of the operand.
Returns
- bool
True if the current left is unequal to the
rightparameter; otherwise, false.