• Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • SixLabors.ImageSharp.Web
      • FormattedImage
      • FormatUtilities
      • ImageCacheMetadata
      • ImageMetadata
    • SixLabors.ImageSharp.Web.Caching
      • CacheHash
      • ICacheHash
      • IImageCache
      • PhysicalFileSystemCache
      • PhysicalFileSystemCacheOptions
    • SixLabors.ImageSharp.Web.Commands
      • CommandParser
      • DictionaryExtensions
      • IRequestParser
      • PresetOnlyQueryCollectionRequestParser
      • PresetOnlyQueryCollectionRequestParserOptions
      • QueryCollectionRequestParser
    • SixLabors.ImageSharp.Web.Commands.Converters
      • ICommandConverter
      • ICommandConverter<T>
    • SixLabors.ImageSharp.Web.DependencyInjection
      • ApplicationBuilderExtensions
      • IImageSharpBuilder
      • ImageSharpBuilderExtensions
      • ImageSharpConfiguration
      • ServiceCollectionExtensions
    • SixLabors.ImageSharp.Web.Middleware
      • ConcurrentDictionaryExtensions
      • ImageCommandContext
      • ImageProcessingContext
      • ImageSharpMiddleware
      • ImageSharpMiddlewareOptions
    • SixLabors.ImageSharp.Web.Processors
      • BackgroundColorWebProcessor
      • FormatWebProcessor
      • IImageWebProcessor
      • JpegQualityWebProcessor
      • ResizeWebProcessor
    • SixLabors.ImageSharp.Web.Providers
      • IImageProvider
      • PhysicalFileSystemProvider
      • ProcessingBehavior
    • SixLabors.ImageSharp.Web.Resolvers
      • IImageCacheResolver
      • IImageResolver
      • PhysicalFileSystemCacheResolver
      • PhysicalFileSystemResolver
    • SixLabors.ImageSharp.Web.Synchronization
      • AsyncKeyLock<TKey>
      • AsyncKeyReaderWriterLock<TKey>
      • AsyncLock
      • AsyncReaderWriterLock
      • RefCountedConcurrentDictionary<TKey, TValue>

    Class ConcurrentDictionaryExtensions

    Extensions used to manage asynchronous access to the ImageSharpMiddleware https://gist.github.com/davidfowl/3dac8f7b3d141ae87abf770d5781feed

    Inheritance
    Object
    ConcurrentDictionaryExtensions
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: SixLabors.ImageSharp.Web.Middleware
    Assembly: SixLabors.ImageSharp.Web.dll
    Syntax
    public static class ConcurrentDictionaryExtensions

    Methods

    | Improve this Doc View Source

    GetOrAddAsync<TKey, TValue>(ConcurrentDictionary<TKey, Task<TValue>>, TKey, Func<TKey, Task<TValue>>)

    Provides an alternative to GetOrAdd(TKey, Func<TKey,TValue>) specifically for asynchronous values. The factory method will only run once.

    Declaration
    public static async Task<TValue> GetOrAddAsync<TKey, TValue>(this ConcurrentDictionary<TKey, Task<TValue>> dictionary, TKey key, Func<TKey, Task<TValue>> valueFactory)
    Parameters
    Type Name Description
    ConcurrentDictionary<TKey, Task<TValue>> dictionary

    The ConcurrentDictionary<TKey,TValue>.

    TKey key

    The key of the element to add.

    Func<TKey, Task<TValue>> valueFactory

    The function used to generate a value for the key

    Returns
    Type Description
    Task<TValue>

    The value for the key. This will be either the existing value for the key if the key is already in the dictionary, or the new value for the key as returned by valueFactory if the key was not in the dictionary.

    Type Parameters
    Name Description
    TKey

    The type of the key.

    TValue

    The value for the dictionary.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX