Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 1 commit into from
Mar 10, 2016

Conversation

nicolas-grekas
Copy link
Member

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.

if (!isset($directory[0])) {
$directory = sys_get_temp_dir().'/symfony-cache';
}
if (!isset($namespace[0])) {
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, fixed

@@ -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);
Copy link
Contributor

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?

Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@xabbuh
Copy link
Member

xabbuh commented Mar 7, 2016

👍

@nicolas-grekas nicolas-grekas force-pushed the cache-std branch 2 times, most recently from d5b8458 to d0530e8 Compare March 10, 2016 07:51
@fabpot
Copy link
Member

fabpot commented Mar 10, 2016

Thank you @nicolas-grekas.

@fabpot fabpot merged commit 5068f87 into symfony:master Mar 10, 2016
fabpot added a commit that referenced this pull request Mar 10, 2016
…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
@nicolas-grekas nicolas-grekas deleted the cache-std branch March 11, 2016 09:21
@fabpot fabpot mentioned this pull request May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants