@@ -106,7 +106,7 @@ public function clear()
106106 {
107107$ this ->deferred = [];
108108if ($ cleared =$ this ->versioningIsEnabled ) {
109- $ namespaceVersion =substr_replace (base64_encode (pack ('V ' ,mt_rand ())),' : ' ,5 );
109+ $ namespaceVersion =substr_replace (base64_encode (pack ('V ' ,mt_rand ())),static :: getNsSeparator () ,5 );
110110try {
111111$ cleared =$ this ->doSave (['@ ' .$ this ->namespace =>$ namespaceVersion ],0 );
112112 }catch (\Exception $ e ) {
@@ -235,13 +235,13 @@ private function getId($key)
235235 CacheItem::validateKey ($ key );
236236
237237if ($ this ->versioningIsEnabled &&'' ===$ this ->namespaceVersion ) {
238- $ this ->namespaceVersion ='1: ' ;
238+ $ this ->namespaceVersion ='1 ' . static :: getNsSeparator () ;
239239try {
240240foreach ($ this ->doFetch (['@ ' .$ this ->namespace ])as $ v ) {
241241$ this ->namespaceVersion =$ v ;
242242 }
243- if ('1: ' ===$ this ->namespaceVersion ) {
244- $ this ->namespaceVersion =substr_replace (base64_encode (pack ('V ' ,time ())),' : ' ,5 );
243+ if ('1 ' . static :: getNsSeparator () ===$ this ->namespaceVersion ) {
244+ $ this ->namespaceVersion =substr_replace (base64_encode (pack ('V ' ,time ())),static :: getNsSeparator () ,5 );
245245$ this ->doSave (['@ ' .$ this ->namespace =>$ this ->namespaceVersion ],0 );
246246 }
247247 }catch (\Exception $ e ) {
@@ -252,7 +252,7 @@ private function getId($key)
252252return $ this ->namespace .$ this ->namespaceVersion .$ key ;
253253 }
254254if (\strlen ($ id =$ this ->namespace .$ this ->namespaceVersion .$ key ) >$ this ->maxIdLength ) {
255- $ id =$ this ->namespace .$ this ->namespaceVersion .substr_replace (base64_encode (hash ('sha256 ' ,$ key ,true )),' : ' , -(\strlen ($ this ->namespaceVersion ) +22 ));
255+ $ id =$ this ->namespace .$ this ->namespaceVersion .substr_replace (base64_encode (hash ('sha256 ' ,$ key ,true )),static :: getNsSeparator () , -(\strlen ($ this ->namespaceVersion ) +22 ));
256256 }
257257
258258return $ id ;
@@ -265,4 +265,12 @@ public static function handleUnserializeCallback($class)
265265 {
266266throw new \DomainException ('Class not found: ' .$ class );
267267 }
268+
269+ /**
270+ * @return string The namespace separator for cache keys.
271+ */
272+ protected static function getNsSeparator ()
273+ {
274+ return ': ' ;
275+ }
268276}