-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Cache] Add namespace handling to all adapters #18024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
b15bd78
to
fe8e9ff
Compare
if (!isset($directory[0])) { | ||
$directory = sys_get_temp_dir().'/symfony-cache'; | ||
} | ||
if (!isset($namespace[0])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be the opposite?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, fixed
fe8e9ff
to
ea0647b
Compare
@@ -20,10 +20,16 @@ class FilesystemAdapter extends AbstractAdapter | |||
{ | |||
private $directory; | |||
|
|||
public function __construct($directory, $defaultLifetime = null) | |||
public function __construct($directory, $defaultLifetime = 0, $namespace = '') | |||
{ | |||
parent::__construct('', $defaultLifetime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the $namespace
be also passed as the first argument to the parent call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no because we handle it differently here: we create a subdir to isolate "namespaces" so there is no need to isolate using key prefixing by the abstract adapter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
👍 |
d5b8458
to
d0530e8
Compare
d0530e8
to
5068f87
Compare
Thank you @nicolas-grekas. |
…s-grekas) This PR was merged into the 3.1-dev branch. Discussion ---------- [Cache] Add namespace handling to all adapters | Q | A | ------------- | --- | Branch | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - This allows more flexible handling of adapters, allowing e.g. to take one cache pool and split in in several sub-pools by using ProxyAdapter. Commits ------- 5068f87 [Cache] Add namespace handling to all adapters
This allows more flexible handling of adapters, allowing e.g. to take one cache pool and split in in several sub-pools by using ProxyAdapter.