Beispiel #1
1
		public static ICache BuildCacheStatic(string regionName, IDictionary<string,string> properties)
		{
			if (regionName != null && caches[regionName] != null)
			{
				return caches[regionName] as ICache;
			}

			if (regionName == null)
			{
				regionName = "";
			}
			if (properties == null)
			{
				properties = new Dictionary<string,string>();
			}
			if (log.IsDebugEnabled)
			{
				StringBuilder sb = new StringBuilder();
				foreach (KeyValuePair<string, string> de in properties)
				{
					sb.Append("name=");
					sb.Append(de.Key);
					sb.Append("&value=");
					sb.Append(de.Value);
					sb.Append(";");
				}
				log.Debug("building cache with region: " + regionName + ", properties: " + sb.ToString());
			}
			FooCache cache = new FooCache(regionName, properties);
			caches.Add(regionName, cache);
			return cache;
		}
Beispiel #2
0
        public static CacheBase BuildCacheStatic(string regionName, IDictionary <string, string> properties)
        {
            if (regionName != null && caches.TryGetValue(regionName, out var cache))
            {
                return(cache);
            }

            if (regionName == null)
            {
                regionName = "";
            }
            if (properties == null)
            {
                properties = new Dictionary <string, string>();
            }
            if (log.IsDebugEnabled)
            {
                StringBuilder sb = new StringBuilder();
                foreach (KeyValuePair <string, string> de in properties)
                {
                    sb.Append("name=");
                    sb.Append(de.Key);
                    sb.Append("&value=");
                    sb.Append(de.Value);
                    sb.Append(";");
                }
                log.Debug("building cache with region: " + regionName + ", properties: " + sb.ToString());
            }
            cache = new FooCache(regionName, properties);
            caches.Add(regionName, cache);
            return(cache);
        }