md5 is faster than crc32 in PHP apparently

Reference https://3v4l.org/2MAUr
This commit is contained in:
Samuel Georges 2017-02-23 07:38:50 +11:00
parent 52bcbc6492
commit c704ddcdf0
3 changed files with 5 additions and 5 deletions

View File

@ -269,7 +269,7 @@ class CmsCompoundObject extends CmsObject
*/
public function getComponentProperties($componentName)
{
$key = crc32($this->theme->getPath()).'component-properties';
$key = md5($this->theme->getPath()).'component-properties';
if (self::$objectComponentPropertyMap !== null) {
$objectComponentMap = self::$objectComponentPropertyMap;
@ -336,7 +336,7 @@ class CmsCompoundObject extends CmsObject
*/
public static function clearCache($theme)
{
$key = crc32($theme->getPath()).'component-properties';
$key = md5($theme->getPath()).'component-properties';
Cache::forget($key);
}

View File

@ -121,7 +121,7 @@ class CodeParser
*/
protected function rebuild($path)
{
$uniqueName = str_replace('.', '', uniqid('', true)).'_'.abs(crc32(mt_rand()));
$uniqueName = str_replace('.', '', uniqid('', true)).'_'.md5(mt_rand());
$className = 'Cms'.$uniqueName.'Class';
$body = $this->object->code;
@ -232,7 +232,7 @@ class CodeParser
*/
protected function getCacheFilePath()
{
$hash = abs(crc32($this->filePath));
$hash = md5($this->filePath);
$result = storage_path().'/cms/cache/';
$result .= substr($hash, 0, 2).'/';
$result .= substr($hash, 2, 2).'/';

View File

@ -308,7 +308,7 @@ class Router
*/
protected function getCacheKey($keyName)
{
return crc32($this->theme->getPath()).$keyName;
return md5($this->theme->getPath()).$keyName;
}
/**