Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin Griffiths 826 posts 1269 karma points c-trib
    Oct 20, 2015 @ 12:22
    Martin Griffiths
    0

    IPublishedContentModelFactory and object caching

    This is a question, probably best answered by Stephan, but if anyone else has a view on it, great!

    I'm using the default (built in) IPublishedContentModelFactory and on Stephans page.. https://github.com/zpqrtbnk/Zbu.ModelsBuilder/wiki/IPublishedContentModelFactory

    It goes into detail about caching because a lot of objects are created each time IPublishedContent is invoked, these apparently have a local rather than an application scope.

    The section is titled... "Content Factory & Content Cache"

    Having looked through the code for modelsbuilder, i've noticed that despite IPublishedContentModelFactory being enabled by default. I cannot see any code to optimise object usage, to create a global scope.

    I guess my question is... If I use either ModelsBuilder or just roll my own POCOs mapped via the IPublishedContentModelFactory. Will I massively increase memory usage as a consequence of not trying to roll a global cache of my own?

    Kind regards

    Martin

  • Stephen 767 posts 2273 karma points c-trib
    Jan 15, 2016 @ 16:40
    Stephen
    0

    (sorry, late reply)

    The factory "just" creates models and creates a new model each time one is requested, ie it does not cache models at all. Caching models would be the job of the front-end content cache. At the moment the Xml-based cache does not cache models at all. So each request gets new instances of the models.

    However, that does not mean that you will see a perf hit when using models. Models are just thin wrappers aroung the original IPublishedContent object, and are cheap to create. The cost comes from creating the IPublishedContent object, and that happens whether you run the factory or not.

    The idea behind refactoring the front-end cache is to not recreate the IPublishedContent objects all the time - that is somehow not related to models and the factory.

    Making sense?

Please Sign in or register to post replies

Write your reply to:

Draft