-
Notifications
You must be signed in to change notification settings - Fork 4
ICacheManager Get
陈明旭 edited this page Apr 5, 2019
·
2 revisions
Welcome to the Materal wiki!
Home Materal Materal.CacheHelper ICacheManager
根据键获取缓存中的对象。如果没有该键则返回null。
参数名 | 类型 | 说明 |
---|---|---|
key | string | 键 |
Object
ICacheManager cacheManager = new MemoryCacheManager();
string inputString = Console.ReadLine();
const string cacheKey = "MyKey";
const double saveHours = 1;
cacheManager.SetByAbsolute(cacheKey, inputString, saveHours);
object cacheSaveObject = cacheManager.Get(cacheKey);
return cacheSaveObject;
根据键获取缓存中的对象。如果没有该键则返回null。
参数名 | 类型 | 说明 |
---|---|---|
key | string | 键 |
T
ICacheManager cacheManager = new MemoryCacheManager();
string inputString = Console.ReadLine();
const string cacheKey = "MyKey";
const double saveHours = 1;
cacheManager.SetByAbsolute(cacheKey, inputString, saveHours);
string cacheSaveString = cacheManager.Get<string>(cacheKey);
return cacheSaveString;