feature#9151 [HttpKernel] made the cache key generation configurable for the default HttpCache store (fabpot)
This PR was merged into the master branch.
Discussion
----------
[HttpKernel] made the cache key generation configurable for the default HttpCache store
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #9088
| License | MIT
| Doc PR | n/a
Commits
-------
780b77a
[HttpKernel] made the cache key generation configurable for the default HttpCache store
This commit is contained in:
commit
a86b35fd7f
@ -364,6 +364,25 @@ class Store implements StoreInterface
|
||||
return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a cache key for the given Request.
|
||||
*
|
||||
* This method should return a key that must only depend on a
|
||||
* normalized version of the request URI.
|
||||
*
|
||||
* If the same URI can have more than one representation, based on some
|
||||
* headers, use a Vary header to indicate them, and each representation will
|
||||
* be stored independently under the same cache key.
|
||||
*
|
||||
* @param Request $request A Request instance
|
||||
*
|
||||
* @return string A key for the given Request
|
||||
*/
|
||||
protected function generateCacheKey(Request $request)
|
||||
{
|
||||
return 'md'.hash('sha256', $request->getUri());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a cache key for the given Request.
|
||||
*
|
||||
@ -377,7 +396,7 @@ class Store implements StoreInterface
|
||||
return $this->keyCache[$request];
|
||||
}
|
||||
|
||||
return $this->keyCache[$request] = 'md'.hash('sha256', $request->getUri());
|
||||
return $this->keyCache[$request] = $this->generateCacheKey($request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user