[TYPO3-core] RFC: #11438: Add a registry to t3lib
Ingo Renner
ingo at typo3.org
Mon Aug 10 17:11:43 CEST 2009
Steffen Kamper wrote:
Hi Steffen,
> i really like the idea of the registry. I read the posts and i also
> would vote for namespacing. This also would avoid key conflicts.
nope it wouldn't, I could still use your namespace and set your entries.
Again, namespaces are there already and with however many arguments we
add, you'll still be able to manipulate other namespaces' entries.
There's no protection intended or wanted. An extension should be able to
read a core entry's value and if necessary if it makes sense also modify
it. (Whoever messes with the core entries must know what he's doing,
like with many other parts of the core (or Windows to take that example
again))
> A general question: what is the difference between the registry and a
> cache? I mean it's used the same way storing a value with a key
> (namespace would be the tag).
> i don't mean cache that will be cleared with "clear all cache", but
> cache has the advantage of using different backends.
> Suggest: i want to use a registry in my extension, but with SESSION
> instead DB, or memory. In case of cache all is already there, only a
> config has to be made.
Basically the purpose/usage is different. Caches for example have a
lifetime after which the entry is not valid anymore, that's not the case
with a Registry. You might want to think of the windows registry as a
perfect example. Windows uses the registry to store user settings and
certain states or information about programs. Drupal, and many other
software systems also do this.
Unfortunately there seems to be no page on wikipedia describing the
registry pattern, I found that one however:
http://www.phppatterns.com/docs/design/the_registry
Another very short one by Martin Fowler:
http://martinfowler.com/eaaCatalog/registry.html
For those amoung us being capable of speaking the German language I also
recommend the following book:
http://www.amazon.de/gp/product/3897214423/ref=sib_rdr_dp
HTH
Ingo
--
Ingo Renner
TYPO3 Core Developer, Release Manager TYPO3 4.2
More information about the TYPO3-team-core
mailing list