public IActionResult Set(string id, string data) { if (id != null && data != null) { var obj = new SingleAccessObject <string>(data); _memoryCache.Set(id, obj, MemoryCacheOptions); } return(View("Set", new[] { GetRandomString(), GetRandomString() })); }
public IActionResult Set(string id, string data) { if (id != null && data != null) { var obj = new SingleAccessObject<string>(data); _memoryCache.Set(id, obj, MemoryCacheOptions); } return View("Set", new[] { GetRandomString(), GetRandomString() }); }
/// <summary> /// Displays the add message page or adds a message to the cache. /// </summary> /// <param name="id"> /// The message id. /// </param> /// <param name="data"> /// The message. /// </param> /// <returns> /// The <see cref="ActionResult"/> message adding view. /// </returns> public ActionResult Set(string id, string data) { if (id != null && data != null) { var obj = new SingleAccessObject<string>(data); System.Web.HttpContext.Current.Cache.Insert(id, obj, null, DateTime.UtcNow.Add(Expiration), Cache.NoSlidingExpiration); } return this.View("Set", null, new[] { GetRandomString(), GetRandomString() }); }