本文整理汇总了C#中CacheManager.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# CacheManager.Insert方法的具体用法?C# CacheManager.Insert怎么用?C# CacheManager.Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheManager
的用法示例。
在下文中一共展示了CacheManager.Insert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var cache = new CacheManager<string>("PigeonCms.HelloWord");
if (cache.IsEmpty(this.BaseModule.Id.ToString()))
{
LitOutput = "This is an HelloWord module.<br />"
+ "Theese are the params you set for the module; <br />"
+ "your name: " + this.YourName + "<br />"
+ "gender: " + this.Gender + "<br />"
+ "age: " + this.Age.ToString() + "<br />";
cache.Insert(this.BaseModule.Id.ToString(), LitOutput);
}
else
{
LitOutput = cache.GetValue(this.BaseModule.Id.ToString());
}
}
示例2: GetImages
public ImageModel GetImages(string path)
{
var cachemanager = new CacheManager<ImageModel>("Images", 60 * 2); // 2 hours?
cachemanager.Clear();
var cached = cachemanager.Grab();
if (cached == null)
{
var controller = path + "ImageModel.Json";
if (FileTools.SFileExists(controller))
cached = JsonHelper.DeserializeFromFile<ImageModel>(controller);
else
{
cached = GetAllUnmangedImages(path);
FileTools.SWriteFile(controller, JsonHelper.Serialize(cached));
}
cachemanager.Insert(cached, CacheItemPriority.Normal);
}
return cached;
}
示例3: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var obj1 = new PigeonCms.Placeholder();
var cache = new CacheManager<PigeonCms.Placeholder>("PigeonCms.Placeholder");
if (cache.IsEmpty(this.Name))
{
obj1 = new PlaceholdersManager().GetByName(this.Name);
cache.Insert(this.Name, obj1);
}
else
{
obj1 = cache.GetValue(this.Name);
}
LitContent.Text = "";
if (obj1.Visible)
{
LitContent.Text = obj1.Content;
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
var sp1 = new StaticPage();
var cache = new CacheManager<StaticPage>("PigeonCms.StaticPage", this.CacheDuration);
if (cache.IsEmpty(this.PageName))
{
if (!StaticPagesManager.ExistPage(this.PageName))
this.PageName = StaticPagesManager.DEFAULT_PAGE_NAME;
sp1 = new StaticPagesManager().GetStaticPageByName(this.PageName);
cache.Insert(this.PageName, sp1);
}
else
{
sp1 = cache.GetValue(this.PageName);
}
if (sp1.ShowPageTitle) LitPageTitle.Text = sp1.PageTitle + "<br />";
LitPageContent.Text = "";
if (!sp1.IsPageContentTranslated)
{
//LitPageContent.Text += "<span class='textNote'>" + Resources.PublicLabels.LblTextNotTranslated + "</span><br />";
}
LitPageContent.Text += sp1.PageContentParsed;
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
CACHE_KEY = "Rows_Items";
CachedList = new CacheManager<List<Item>>("AQ.CacheSample");
List<Item> list;
if (!Page.IsPostBack)
{
}
if (CachedList.IsEmpty(CACHE_KEY))
{
LitRes.Text = "data from db";
list = getList();
CachedList.Insert(CACHE_KEY, list);
}
else
{
LitRes.Text = "data from cache";
list = CachedList.GetValue(CACHE_KEY);
}
LitRows = renderRows(list);
}