2010年8月23日星期一

Re: [fw-mvc] Centralized Stack/Broker or something for Models

On Monday 23 Aug 2010 05:00:13 Michael Depetrillo wrote:
> I would think there is better performance by storing the data as a
> class property. Otherwise, you open/close the same cache file every
> time you access the cache from the front controller, controller,
> model, etc...

Most of the time you lookup the authenticated user. The user model acts with
Zend_Auth so in controllers only the api of the model is exposed:

- Application_Model_User::getAuthenticated()
- Application_Model_User::authenticate($username, $password)
- Application_Model_User::isAuthenticated()

And getAuthenticated() is obviously called my times during a request. The call
to the db is once made and then stored as static property. Look for a snippet
of my code at http://pastebin.com/iK1mfDmq.

Regards, Jurian
--
Jurian Sluiman
CTO Soflomo V.O.F.
http://soflomo.com

没有评论: