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?
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.
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
(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?
is working on a reply...