@@ -40,6 +40,11 @@ class ConfigurationOption extends ArrayObject
4040 */
4141 protected $ defaultKeyHashFunction = 'md5 ' ;
4242
43+ /**
44+ * @var string|Callable
45+ */
46+ protected $ defaultFileNameHashFunction = 'md5 ' ;
47+
4348 /**
4449 * @var int
4550 */
@@ -263,6 +268,28 @@ public function setDefaultKeyHashFunction($defaultKeyHashFunction)
263268 return $ this ;
264269 }
265270
271+ /**
272+ * @return Callable|string
273+ */
274+ public function getDefaultFileNameHashFunction ()
275+ {
276+ return $ this ->defaultFileNameHashFunction ;
277+ }
278+
279+ /**
280+ * @param Callable|string $defaultKeyHashFunction
281+ * @return ConfigurationOption
282+ * @throws PhpfastcacheInvalidConfigurationException
283+ */
284+ public function setDefaultFileNameHashFunction ($ defaultFileNameHashFunction )
285+ {
286+ if (!\function_exists ($ defaultFileNameHashFunction ) || !\is_callable ($ defaultFileNameHashFunction )) {
287+ throw new PhpfastcacheInvalidConfigurationException ('defaultFileNameHashFunction must be a valid function name string ' );
288+ }
289+ $ this ->defaultFileNameHashFunction = $ defaultFileNameHashFunction ;
290+ return $ this ;
291+ }
292+
266293 /**
267294 * @return int
268295 */
@@ -445,7 +472,7 @@ public function setCacheFileExtension(string $cacheFileExtension): self
445472 }
446473 if (!\in_array ($ cacheFileExtension , $ safeFileExtensions , true )) {
447474 throw new PhpfastcacheInvalidConfigurationException (
448- "{$ cacheFileExtension } is not a safe extension , currently allowed extension: " . \implode (', ' , $ safeFileExtensions )
475+ "Extension \" {$ cacheFileExtension }\" is not safe, currently allowed extension names : " . \implode (', ' , $ safeFileExtensions )
449476 );
450477 }
451478
0 commit comments