locked
How to implement caching in an enterprise application RRS feed

  • Question

  • User-545631939 posted

    Gurus!

    I have been researching on the topic of caching in enterprise applications. Every document I have been looking has been suggesting that caching should be implemented at all layers. That is a good practice which can speed up application performance.

    But the problem Gurus, is that I am not really getting a hold on how exactly to implement it. I understand that third party frameworks such as Spring.NET, Castle Windsor, as well as MS Caching Application Block all can help in implementing caching. I have also read about caching patterns such as 'primed cache', 'on - demand cache' etc., I understand these are useful if I am building caching into my application at design time itself.

    Gurus, can you please show me any document or other resource which shows how to implement caching in a step by step manner in an application?

    Also, if I choose to implement caching at design time itself, how do I go about it Gurus? I am sure my Gurus here on this forum have implemented caching in many enterprise applications. Please enlighten me O Gurus, firstly on how to get a start with caching, and then proceed to fully implement it across all layers in my application.

    Novice Kid

    Friday, March 15, 2013 12:19 PM

Answers

  • User-1716951449 posted

    .net already has built-in caching mechanism, System,Web.Caching.Cache

    basically we want to use server memory to cache, we don't want to use db datastore. if you using db, there's no point in using "caching".

    because db read write is far slower than memory.

    google asp.net and caching and example, mr google can dump you lots examples.

    when using caching, you may look into write/update the cache, especially on thread-safety, web-farm. or you can ignore this 1st, just get the hang with cache, and discuss/research further when you get the hang of it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 27, 2013 3:26 AM
  • User-1716951449 posted

    you can just take the sample from ms cache app block, customize it for your own need.

    i believe they also using the web cache object, which should be usable for non-web app as well.

    regardless, you can just adopt the app block, use as black-box system, as long as it serve your need.

     

    in term of caching, it's practical use for data that need to read frequently, but seldom change.

    you want to avoid unnessary database reading, which almost 90% of the time you expecting getting the same data, so caching is practical here.

    for data that tends to be volatile/changing, its up to you to decide, but i would suggest don't over-engineer it, do without cache. simple work/design, less bug.

    when you got the hang/experience with it, you will then decide what and how to move on.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 29, 2013 6:37 AM

All replies

  • User-545631939 posted

    Haven't any of my Gurus implemented caching?

    Ok, if I may ask a question, when building caching into the application at design time itself, are we supposed to design the data store itself? Or is the data store a given and we only need to design update and retrieval strategies?

    Help me O Gurus, I am completely lost on this. Don't know where to make a start.

    Novice Kid

    Tuesday, March 26, 2013 10:04 AM
  • User-1716951449 posted

    .net already has built-in caching mechanism, System,Web.Caching.Cache

    basically we want to use server memory to cache, we don't want to use db datastore. if you using db, there's no point in using "caching".

    because db read write is far slower than memory.

    google asp.net and caching and example, mr google can dump you lots examples.

    when using caching, you may look into write/update the cache, especially on thread-safety, web-farm. or you can ignore this 1st, just get the hang with cache, and discuss/research further when you get the hang of it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 27, 2013 3:26 AM
  • User-545631939 posted

    Thanks for your reply Guru Kelmen, but I was interested in knowing how to implement caching at every layer of an enterprise application. System.Web.Caching cannot be used at the business tier can it? I am interested in knowing how to integrate a caching mechanism into the architecture itself.

     I have been searching and researching and doing everything else related to it, but somehow, ain't able to make a start to it. If you know of any examples or resources that show it being implemented step by step at all layers for at least a skeleton application, I would greatly appreciate it!

    Novice Kid

     

    Wednesday, March 27, 2013 4:39 AM
  • User-1716951449 posted

    you can just take the sample from ms cache app block, customize it for your own need.

    i believe they also using the web cache object, which should be usable for non-web app as well.

    regardless, you can just adopt the app block, use as black-box system, as long as it serve your need.

     

    in term of caching, it's practical use for data that need to read frequently, but seldom change.

    you want to avoid unnessary database reading, which almost 90% of the time you expecting getting the same data, so caching is practical here.

    for data that tends to be volatile/changing, its up to you to decide, but i would suggest don't over-engineer it, do without cache. simple work/design, less bug.

    when you got the hang/experience with it, you will then decide what and how to move on.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, March 29, 2013 6:37 AM