Wednesday, May 26, 2010

Re: about Singleton instance

Its a multiton instance.

http://en.wikipedia.org/wiki/Multiton_pattern

On May 26, 3:35 am, len <yulei...@gmail.com> wrote:
> Hi All
>
> I have a question about Singleton instance.
>
> cake/libs/configure.php L133
>
> function&getInstance($boot = true) {
>      static $instance = array();
>          if (!$instance) {
>              $instance[0] =&  new Configure();
>              $instance[0]->__loadBootstrap($boot);
>          }
>      return $instance[0];
>
> }
>
> why type of $instance is array.
>
> Is the following ok?
>
> static $instance;
> if (!$instance) {
>      $instance =&  new Configure();
>
> }
>
> Thanks in advanced
>
> len

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: