2009年5月3日星期日

Re: [fw-core] Zend_Db_Table_Abstract

-- Matthias Buesing, mediaraum <matthias.buesing@mediaraum.com> wrote
(on Saturday, 02 May 2009, 07:53 PM +0200):
> in Zend_Db_Table_Abstract.php there is a function
> "protected function _setupMetadata()" in which this line appears:
>
> $cacheId = md5("$this->_schema.$this->_name");
>
> My questions are:
> What is the reason to md5 the cacheId?
> Isn't it potentially dangerous to build the cache-ID this way?
> What about the risk of md5-collisions if other modules build
> their cache-IDs like this, too?

First off, MD5 collisions are really, really rare, so that's not much of
a worry.

The reason that md5 is used to create the cacheId is because Zend_Cache
is very restrictive in what it allows for cache identifiers; providing
an md5sum is a way to ensure the identifier will be correctly formatted
for use with it.

--
Matthew Weier O'Phinney
Project Lead | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: