public void AddCacheProxies(string host, ServiceCacheProxy cacheProxy)
		{
			proxyLock.EnterWriteLock();
			try
			{
				cacheProxies.Remove(host);
				cacheProxies.Add(host, cacheProxy);
			}
			finally
			{
				proxyLock.ExitWriteLock();
			}
		}
Exemple #2
0
 public void AddCacheProxies(string host, ServiceCacheProxy cacheProxy)
 {
     proxyLock.EnterWriteLock();
     try
     {
         cacheProxies.Remove(host);
         cacheProxies.Add(host, cacheProxy);
     }
     finally
     {
         proxyLock.ExitWriteLock();
     }
 }
Exemple #3
0
        public void Remove(object key, Type ValueType)
        {
            string valueKey = key.ToString() + "_" + ValueType.Name;
            string id       = cacheLocal.Get(valueKey);

            cacheLocal.Remove(valueKey);
            string[]          str        = id.Split(new char[] { '_' }, 1);
            string            host       = str[0];
            ServiceCacheProxy cacheProxy = cacheProxies[host];

            if (cacheProxy != null)
            {
                cacheProxy.Remote(valueKey);
            }
        }
Exemple #4
0
        public void Insert(object key, IDbObject value, TimeSpan time, bool isRelative, ObjectRemoved removeDelegate)
        {
            string valueKey = key.ToString() + "_" + value.GetType().Name;
            string id       = cacheLocal.Get(valueKey);

            if (id != null)
            {
                string[]          str        = id.Split(new char[] { '_' }, 1);
                string            host       = str[0];
                ServiceCacheProxy cacheProxy = cacheProxies[host];
                if (cacheProxy != null)
                {
                    cacheProxy.BeginInsert(FinishInsert, new object[] { valueKey, time, isRelative, removeDelegate }, value, time, isRelative, null);
                }
            }
            //TODO insert
        }
Exemple #5
0
        public object Get(object key, Type ValueType)
        {
            string valueKey = key.ToString() + "_" + ValueType.Name;
            string id       = cacheLocal.Get(valueKey);

            if (id != null)
            {
                string[]          str        = id.Split(new char[] { '_' }, 1);
                string            host       = str[0];
                ServiceCacheProxy cacheProxy = cacheProxies[host];
                if (cacheProxy != null)
                {
                    return(cacheProxy.Get(valueKey));
                }
            }
            //queryDatabase va insert
            return(null);
        }