Ejemplo n.º 1
0
		/// <summary>
		/// Internal function within FAP for marking pages as static pages, to be cloned for individual user page instances.
		/// Using this function is an incredibly bad idea.
		/// </summary>
		static internal void SetStatic(Page p)
		{
			if (p.PageCache == null) {
				p.isstatic = true;
				p.PageCache = new Dictionary<int, Page>();
			}
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Adds a page, mostly
		/// </summary>
		/// <param name="p">Pages, single pages</param>
		public void AddPage(Page p)
		{
			if (p != null) {
				Page.SetStatic(p);
				pagelist.Add(p.Path, p);
			}
		}
Ejemplo n.º 3
0
		/// <summary>
		/// Removes a page, mostly
		/// </summary>
		/// <param name="p">Pages, single pages</param>
		public void RemovePage(Page p)
		{
			if (p != null && pagelist.ContainsKey(p.Path))
				pagelist.Remove(p.Path);
		}
Ejemplo n.º 4
0
		async void cacheAdd(int cacheVars, Page toAdd, Page parentPage)
		{
			try {
				parentPage.PageCache.Add(cacheVars, toAdd);
				while (toAdd != null) {
					await Task.Delay(CacheMaxAge);
					if (toAdd.PageAge > CacheMaxAge) {
						parentPage.PageCache.Remove(cacheVars);
						toAdd = null;
						break;
					}
				}
			} catch (Exception e) {
				Console.Error.WriteLine("02: " + DateTime.UtcNow + " Async Exception " + e.Message);
				if (parentPage != null && parentPage.PageCache != null && parentPage.PageCache.ContainsKey(cacheVars))
					parentPage.PageCache.Remove(cacheVars); //Oh the paranoia
			}
		}