Base solution for your next web application
Open Closed

Using CacheManager #2559


User avatar
0
bilalhaidar created

Hello,

Is there an example of using CacheManager in an AppService to see how to save/get data?

Thanks


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    There are some places, you can search for "cacheManager" for all of them. Here are two of them <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Application/Caching/CachingAppService.cs">https://github.com/aspnetzero/aspnet-ze ... Service.cs</a> <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Core/Friendships/Cache/UserFriendsCache.cs">https://github.com/aspnetzero/aspnet-ze ... dsCache.cs</a>

  • User Avatar
    0
    bilalhaidar created

    Thanks a lot. Those examples are nice, but only show how to retrieve from Cache. I never saw where do these classes Set data in Cache not only Get, who is setting their data?

    BTW, is there a documentation on Chat and Friendship somewhere?

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Actually it works like this, When you request an item from cache, if it does not exist in the cache, this method is used to retrieve the item and it's result is added to cache. <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero/blob/master/src/MyCompanyName.AbpZeroTemplate.Core/Friendships/Cache/UserFriendsCache.cs#L164">https://github.com/aspnetzero/aspnet-ze ... he.cs#L164</a>

    When you request the same item again, it will be retrieved from cache.

    Chat and Friendship does not have a detailed documentation. There is only this one but I think you have already read it :). <a class="postlink" href="https://aspnetzero.com/Documents/Development-Guide-Core#chat">https://aspnetzero.com/Documents/Develo ... -Core#chat</a>

  • User Avatar
    0
    bilalhaidar created

    LoL yeah I read it many times now :-)

    Ok no problem, what's the general concept? Is there an article online that has a similar concept explained? I can then go through code, but at least get some details on its logic, etc.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is explained here <a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Caching#icache">http://aspnetboilerplate.com/Pages/Docu ... ing#icache</a>. I cannot suggest any online document, sorry.