diff --git a/src/Stash/Driver/FileSystem.php b/src/Stash/Driver/FileSystem.php index 5609a350..b308f746 100644 --- a/src/Stash/Driver/FileSystem.php +++ b/src/Stash/Driver/FileSystem.php @@ -68,7 +68,8 @@ class FileSystem implements DriverInterface protected $defaultOptions = array('filePermissions' => 0660, 'dirPermissions' => 0770, 'dirSplit' => 2, - 'memKeyLimit' => 20 + 'memKeyLimit' => 20, + 'keyHashFunction' => 'md5' ); public function __construct(array $options = array()) @@ -91,6 +92,13 @@ public function __construct(array $options = array()) $options['memKeyLimit'] = 0; } + if (function_exists($options['keyHashFunction'])) { + $this->keyHashFunction = $options['keyHashFunction']; + } + else { + $this->keyHashFunction = 'md5'; + } + $this->memStoreLimit = (int)$options['memKeyLimit']; $this->checkFileSystemPermissions(); @@ -248,7 +256,7 @@ protected function makePath($key = null) $pathPieces = array(); $path = $basePath; $len = floor(32 / $this->directorySplit); - $key = \Stash\Utilities::normalizeKeys($key); + $key = \Stash\Utilities::normalizeKeys($key, $this->keyHashFunction); foreach ($key as $index => $value) { if (strpos($value, '@') === 0) {