Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FIX: allow the FileSystem driver to configure the key hashing function.

  • Loading branch information...
commit f51fbae24bfb4e21d6116c8218f564c208f79324 1 parent 24bbc64
Phillip Whelan pwhelan authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 src/Stash/Driver/FileSystem.php
12 src/Stash/Driver/FileSystem.php
View
@@ -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) {
Please sign in to comment.
Something went wrong with that request. Please try again.