1

我正在使用ironyx/dache分布式缓存。
我创建了一个单例对象CacheClient并在当前项目中使用它。

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

    private CacheClientSingleton() { }
}

使用 dache 的 CacheClient 或 ... 可以吗?

4

1 回答 1

1

CacheClient旨在用作单例。在 Dache 的早期版本中,XML 注释没有正确指出这一点。您的代码是最佳的。

于 2014-12-03T04:13:59.897 回答