Build static cache in .net based applications RRS feed

  • Question

  • Have a three layer .net based application designed in the following way.

    1) on app start initialise all services, repositories, databasefactory using Microsoft unity in unityconfig class(Present layer)

    2) load repositories and unitOfWork in services class(bll layer)

    3) load datafactory (dal layer)

    Loading is all done via constructor overload method and implemented generic rep pattern.

    Q) If I want to build some static cache in presentation layer on application statup, how to implement this as I cannot call any services or repositories with out loading. 

    Is this bad design? 




    Friday, February 26, 2016 1:20 PM

All replies

  • what real-world tiers are involved in your app?


    Monday, February 29, 2016 12:19 AM
  • Hi,

    Its just single tier application scaled on application and SQl server. Hope this answered your question.



    Monday, February 29, 2016 3:54 PM
  • Single tier? So your client on the SQL Server box? Why would you want a caching layer if you're that close to the Db? Anyway, you can need to choose if you want to cache the models in your repository or if you want to cache the responses from the server. The former can provide improvements such as a faster startup, but caching the responses can allow you to more easily scale if you start to use web technology for your transport. At this point I'm not really sure how you intend to scale your solution.


    Monday, February 29, 2016 9:53 PM
  • hi, 

    Its a windows based but it will be extending to web based soon. OK I am trying to cache the lkptypes on start up mode which is static data dont change. often. 

    What is the best way to build cache?



    Tuesday, March 1, 2016 1:59 PM
  • As I say, it depends on what you are trying to achieve, or what performance problem you are trying to reduce. Even semi-tombstone may need changing. I would take a look at Etags and caching the web responses.


    Tuesday, March 1, 2016 9:01 PM