Base solution for your next web application
Open Closed

Caching Disposable items #1293


User avatar
0
david created

Hi,

I was wondering if there is any way to store disposable items in cache?

Basically, if i could achieve functionality like this: <a class="postlink" href="http://stackoverflow.com/a/32706574/6223751">http://stackoverflow.com/a/32706574/6223751</a> for a cacheitem, it would be great.

Thanks


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    While cache items should be simple and does not contain desctuction code normally, it may be needed. Can you create an issue for that on Github: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/new">https://github.com/aspnetboilerplate/as ... issues/new</a>

  • User Avatar
    0
    david created

    Hi hikalkan,

    Thanks for your response. As abp cache is extending memory cache, it could be nice if we can use the methods provides. I agree that is not best practice to storing disposable items in cache, however this is a gray zone :D it is a costly initialization and wanted to test whether cache or singleton performs better in long term running. In addition to the previous question, ive also tried redis cache. I noticed that if i try to clear all caches in initialize method(as redis is still running after application restart and previous cached items persist) i get an exception. I didnt had the time to test whether the exception is thrown while trying to clear the container of holding disposable objects or not. Maybe tomorrow.

  • User Avatar
    0
    hikalkan created
    Support Team

    This discussion is continued here: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1104">https://github.com/aspnetboilerplate/as ... ssues/1104</a>