Search Results for

    Show / Hide Table of Contents

    Class CacheHelperExtensionMethods

    Extension methods for the IObjectCache interface

    Inheritance
    System.Object
    CacheHelperExtensionMethods
    Namespace: ImageVault.Common.Data.Caching
    Assembly: ImageVault.Common.dll
    Syntax
    public static class CacheHelperExtensionMethods : Object
    Remarks

    This is the only construct that allows optional arguments with an implicit interface implementation It is not good to use optional parameters with default values in interfaces anyway since they can vary depending on how you call them.

    Methods

    GetOrCreate<T>(CacheHelper, String, Func<T>)

    Gets or creates a cache without expiration

    Declaration
    public static T GetOrCreate<T>(this CacheHelper helper, string name, Func<T> createAction)
    Parameters
    Type Name Description
    CacheHelper helper
    System.String name
    System.Func<T> createAction
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    GetOrCreateAbsoluteCache<T>(CacheHelper, String, TimeSpan, Func<T>)

    Gets or creates a cache with an absolute expiration

    Declaration
    public static T GetOrCreateAbsoluteCache<T>(this CacheHelper helper, string name, TimeSpan absoluteExpiration, Func<T> createAction)
    Parameters
    Type Name Description
    CacheHelper helper
    System.String name
    System.TimeSpan absoluteExpiration
    System.Func<T> createAction
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    GetOrCreateAbsoluteCacheAsync<T>(CacheHelper, String, TimeSpan, Func<Task<T>>)

    Declaration
    public static Task<T> GetOrCreateAbsoluteCacheAsync<T>(this CacheHelper helper, string name, TimeSpan absoluteExpiration, Func<Task<T>> createAction)
    Parameters
    Type Name Description
    CacheHelper helper
    System.String name
    System.TimeSpan absoluteExpiration
    System.Func<System.Threading.Tasks.Task<T>> createAction
    Returns
    Type Description
    System.Threading.Tasks.Task<T>
    Type Parameters
    Name Description
    T

    GetOrCreateSlidingCache<T>(CacheHelper, String, TimeSpan, Func<T>)

    Gets or creates a cache with a sliding expiration

    Declaration
    public static T GetOrCreateSlidingCache<T>(this CacheHelper helper, string name, TimeSpan slidingExpiration, Func<T> createAction)
    Parameters
    Type Name Description
    CacheHelper helper
    System.String name
    System.TimeSpan slidingExpiration
    System.Func<T> createAction
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    TryGet<T>(CacheHelper, String, out T)

    Declaration
    public static bool TryGet<T>(this CacheHelper helper, string name, out T value)
    Parameters
    Type Name Description
    CacheHelper helper
    System.String name
    T value
    Returns
    Type Description
    System.Boolean
    Type Parameters
    Name Description
    T

    TryGetOrCreate<T>(CacheHelper, String, Func<T>, out T)

    Declaration
    public static bool TryGetOrCreate<T>(this CacheHelper helper, string name, Func<T> createAction, out T value)
    Parameters
    Type Name Description
    CacheHelper helper
    System.String name
    System.Func<T> createAction
    T value
    Returns
    Type Description
    System.Boolean
    Type Parameters
    Name Description
    T
    In This Article
    Back to top (c) Meriworks 2002-2022