Search code examples
asp.netasp.net-mvcdistributed-cachedache

How to use dache's CacheClient in ASP.NET MVC?


I'm using ironyx/dache for distributed caching.
I created a singleton object of CacheClient and using it in the current project.

internal class CacheClientSingleton
{
    private static CacheClient _instance;
    public static CacheClient GetInstance
    {
        get { return _instance ?? (_instance = new CacheClient()); }
    }

    private CacheClientSingleton() { }
}

Is it OK this using of dache's CacheClient or ... ?


Solution

  • The CacheClient is intended to be used as a singleton. In prior versions of Dache, the XML comments did not properly indicate this. Your code is optimal.