/// <summary>
        /// Getting value from Database
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public object GetValue(string key)
        {
            //make all waiting threads stay here and not pass this point
            waitHandle.WaitOne();

            log.DebugFormat("databaseStore.GetValue({0}), dateTime:{1}", key, DateTime.UtcNow.ToString("fff"));

            var result = databaseStore.GetValue(key);

            return(result);
        }
Exemple #2
0
        public object GetValue(string key)
        {
            log.DebugFormat("Start Getting Key:{0}", key);

            var value = cacheStore.GetValue(key);

            if (value == null)
            {
                value = databaseStore.GetValue(key);

                log.DebugFormat("Read value from database, key:{0}", key);

                cacheStore.StoreValue(key, value);
            }
            else
            {
                log.DebugFormat("Read value from Cache, key:{0}", key);
            }

            log.DebugFormat("Finsih Getting Key:{0}", key);

            return(value);
        }