[TYPO3-core] RFC #9505: Make the caches in TYPO3 use the new caching framework

Martin Kutschker masi-no at spam-typo3.org
Wed Oct 8 13:41:29 CEST 2008


Robert Lemke schrieb:
> 
> The t3lib_div::makeInstance() function should become aware of scopes. In
> TYPO3 v4
> the default scope should be "Prototype", because that's the current
> behaviour
> of makeInstance(). If you want to make the solution upwards compatible,
> you'd have
> to scan the doc comment of the class in question:
> 
> /**
>  * My Class
>  * @scope singleton
>  */
> class tx_myextension_myclass {}
> 
> That would be the cleanest solution in my opinion. However, you'll have
> to find out
> if that turns out to be a problem speed-wise (due to Reflection). Just
> try it and
> do some proper profiling with xdebug ...

A simple solution is to have all singletons have a certain "magic"
property eg t3libSingleton. It doesn't matter if that is inherited from
an abstract singleton class or if it's an implementation of an interface
*. The only purpose is that it's presence can be detected with
property_exists() which works on classes (and objects). Mind that it's
of no important which value the property has, setting it to 0, NULL or
FALSE will not change the behaviour!

This way we can avoid the reflection. We don't use it in 4.x and I don't
think we should bring it into the codebase.

Masi

* We might offer both solutions for "documentation purposes".


More information about the TYPO3-team-core mailing list