![]() ![]() Public async Task InsertOrUpdateAsync(string key, TObject obj) String val = JsonConvert.SerializeObject(obj) Public void InsertOrUpdate(string key, TObject obj) Public RedisCacheRepository(IDatabase cache) Public class RedisCacheRepository : ICacheRepository where TObject : class ![]() The RedisCacheRepository is responsible to managing access to redis cache: Internal sealed class Configuration : DbMigrationsConfiguration In my case, the solution that I’ve adopted is to use Azure Redis Cache to store the nodes of the tree and StackExchange.Redis as client library.įirst of all, I use EF Code First and I’ve two tables, node and relations migrations are enabled and the Seed Method of Configuration class is overridden to populate the database with test datas: In my case, the hierarchical tree is composed on two sql table (node and relations) the problem was that with a large number of nodes and relations, the performance slow down drammatically. SerializeObject(p3), p3.Scores) įoreach ( var res2 in cacheLookup.Recursive method are very useful to process for example, parent/child relations and build organization trees.īut for complex trees is very frequently to encounter performance problems, specially if the tree is build for every request. SerializeObject(p2), p2.Scores) ĬacheLookup.SortedSetAdd( “scorerList”, JsonConvert. SerializeObject(p1),p1.Scores) ĬacheLookup.SortedSetAdd( “scorerList”, JsonConvert. Protected void Page_Load( object sender, EventArgs e) ĬacheLookup.SortedSetAdd( “scorerList”, JsonConvert.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |