public static CouchbaseCacheManager <T, Key> GetSafeInstance(string instanceName, System.Func <Key, T> func, TimeSpan expiration)
        {
            lock (instancesLock)
            {
                string instanceFullName = instanceName + "|" + typeof(T).ToString() + "|" + typeof(Key).ToString();

                if (!instances.ContainsKey(instanceFullName))
                {
                    instances[instanceFullName] = new CouchbaseCacheManager <T, Key>(instanceName, func, expiration);
                }
                return((CouchbaseCacheManager <T, Key>)instances[instanceFullName]);
            }
        }
Beispiel #2
0
        public static CouchbaseCacheManager <T, Key> GetSafeInstance(string instanceName, System.Func <Key, T> func, TimeSpan expiration,
                                                                     string[] serversUrl, string couchbaseBucketName, string username, string password,
                                                                     Func <Key, string> keyValueSelector = null)
        {
            lock (instancesLock)
            {
                string instanceFullName = instanceName + "|" + typeof(T).ToString() + "|" + typeof(Key).ToString();

                if (!instances.ContainsKey(instanceFullName))
                {
                    instances[instanceFullName] = new CouchbaseCacheManager <T, Key>(instanceName, func, expiration,
                                                                                     serversUrl, couchbaseBucketName, username, password,
                                                                                     keyValueSelector: keyValueSelector);
                }
                return((CouchbaseCacheManager <T, Key>)instances[instanceFullName]);
            }
        }