Example #1
0
        /// <summary>
        /// Adds an object to the SQLCache
        /// </summary>
        public static void AddToCache(string Key, object Obj, ref SQLOptions o)
        {
            if (System.Web.HttpContext.Current == null)
            {
                throw new Exception("Caching is not available outside of web context");
            }

            //if(log == null)
            //log = new TextLog();

            if (o.DoFileCache)
            {
                try
                {
                    SQLFileCache.AddToFileCache(Key, Obj, ref o);
                }
                catch (Exception ex)
                {
                    o.WriteToLog("Error trying to save to SQL FileCache: " + ex.Message);
                    General.Debugging.Report.SendError("Error trying to save to SQL FileCache", ex);
                }
            }

            if (o.DoMemoryCache)
            {
                SQLMemoryCache.AddToMemoryCache(Key, Obj, ref o);
            }
        }