1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MVC & Caching

Discussion in 'XenForo Development Discussions' started by ragtek, Jan 30, 2011.

  1. ragtek

    ragtek Guest

    I've read several articles about caching.
    Some of they say, that the caching should happen in the model, other say that it should happen in the controller.



    (ATM i'm always reading & writing in the controller and never in the model), but i thought very often, that it would be much better in the model, because i could use model->getFromCache() instead of
    PHP:
    $cache cache::getInstance();
    if (
    $cache->read('myKey..');
    $foo $model::read();
    $cache->write('key'$foo);
    ..
    What do the xenforo coders/addon coders think?

    I know there is no "real way", it's like the discussion about fat model vs fat controller^^



    Edit: nevermind, i've saw that xenforo provides already cacheaccess in the model:)
     
  2. Mike

    Mike XenForo Developer Staff Member

    XenForo really follows fat model/thin controller, mostly because controller code is hard to reuse.
     
    Kier, Jeremy and Darkimmortal like this.

Share This Page