Exemple #1
0
        public DataTable GetDataTable()
        {
            DataTable result;

            if (CacheSettings.Enabled)
            {
                string queryKey = GetQueryCacheKey();

                if (CacheSettings.Flush)
                {
                    QueryCache.Remove(queryKey);
                }

                result = QueryCache.Get(queryKey);
                if (result == null)
                {
                    result = GetDataTableDirectlyFromDatabase();
                    QueryCache.Set(queryKey, result, CacheSettings.ExpirationType, CacheSettings.ExpirationTime);
                }
            }
            else
            {
                result = GetDataTableDirectlyFromDatabase();
            }

            return(result);
        }
Exemple #2
0
        public void Flush()
        {
            string queryKey = GetQueryCacheKey();

            QueryCache.Remove(queryKey);
        }