本文整理汇总了C#中ICacheProvider.Invalidate方法的典型用法代码示例。如果您正苦于以下问题:C# ICacheProvider.Invalidate方法的具体用法?C# ICacheProvider.Invalidate怎么用?C# ICacheProvider.Invalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICacheProvider
的用法示例。
在下文中一共展示了ICacheProvider.Invalidate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateAllCourses
public static void GenerateAllCourses(ICourseStorage courseStorage, ICacheProvider cacheProvider)
{
var path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
path = path.Replace("IUDICO.LMS/Plugins/IUDICO.DataGenerator.DLL", "IUDICO.DataGenerator/Content/Courses/");
if (Directory.Exists(path))
{
var files = Directory.GetFiles(path, "*.zip",SearchOption.TopDirectoryOnly);
foreach (var file in files)
{
var name = Path.GetFileNameWithoutExtension(file);
if (!courseStorage.GetCourses().Any(c => c.Name == name && c.Owner == "prof3"))
{
courseStorage.Import(file, "prof3");
Course course = courseStorage.GetCourses().SingleOrDefault(c => c.Name == name && c.Owner == "prof3");
if (course != null && course.Locked.Value)
{
courseStorage.Parse(course.Id);
cacheProvider.Invalidate("course-" + course.Id, "courses");
}
}
}
}
}
示例2: PascalCourse
public static void PascalCourse(ICourseStorage courseStorage, ICacheProvider cacheProvider, string path)
{
if (Directory.Exists(path))
{
var files = Directory.GetFiles(path,"*.zip");
foreach (var file in files)
{
var name = Path.GetFileNameWithoutExtension(file);
if (!courseStorage.GetCourses().Any(c => c.Name == name && c.Owner == "OlehVukladachenko"))
{
courseStorage.Import(file, "OlehVukladachenko");
}
Course course = courseStorage.GetCourses().SingleOrDefault(c => c.Name == name && c.Owner == "OlehVukladachenko");
if (course != null && course.Locked.Value )
{
courseStorage.Parse(course.Id);
cacheProvider.Invalidate("course-" + course.Id, "courses");
}
}
}
}