mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-11-09 02:44:58 +08:00
-
This commit is contained in:
@@ -8,10 +8,10 @@ namespace SqlSugar
|
|||||||
internal class CacheSchemeMain
|
internal class CacheSchemeMain
|
||||||
{
|
{
|
||||||
|
|
||||||
public static T GetOrCreate<T>(ICacheService cacheService, SqlSugarClient context, QueryBuilder queryBuilder,Func<T> getData)
|
public static T GetOrCreate<T>(ICacheService cacheService,QueryBuilder queryBuilder,Func<T> getData,int cacheDurationInSeconds, SqlSugarClient context)
|
||||||
{
|
{
|
||||||
string key = CacheKeyBuider.GetKey(context,queryBuilder).ToString();
|
string key = CacheKeyBuider.GetKey(context,queryBuilder).ToString();
|
||||||
var result= cacheService.GetOrCreate(key, () => getData());
|
var result= cacheService.GetOrCreate(key, () => getData(), cacheDurationInSeconds);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ namespace SqlSugar
|
|||||||
V Get<V>(string key);
|
V Get<V>(string key);
|
||||||
IEnumerable<string> GetAllKey<V>();
|
IEnumerable<string> GetAllKey<V>();
|
||||||
void Remove<V>(string key);
|
void Remove<V>(string key);
|
||||||
V GetOrCreate<V>(string cacheKey, Func<V> create);
|
V GetOrCreate<V>(string cacheKey, Func<V> create,int cacheDurationInSeconds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user