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

Skip to content

[Cache] Add CacheItem::validateKey utility method #18597

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
Apr 20, 2016

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Apr 20, 2016

Q A
Branch? 3.1
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Ping @dunglas

@stof
Copy link
Member

stof commented Apr 20, 2016

👍

@nicolas-grekas nicolas-grekas merged commit af09cde into symfony:master Apr 20, 2016
nicolas-grekas added a commit that referenced this pull request Apr 20, 2016
…olas-grekas)

This PR was merged into the 3.1-dev branch.

Discussion
----------

[Cache] Add CacheItem::validateKey utility method

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Ping @dunglas

Commits
-------

af09cde [Cache] Add CacheItem::validateKey utility method
@nicolas-grekas nicolas-grekas deleted the cache-valid branch April 20, 2016 14:17
@@ -336,19 +335,9 @@ public function __destruct()
}
}

private function getId($key, $ns = false)
private function getId($key)
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for adding comments in a merged PR, but this was merged a bit quickly. I have some concerns about how validateKey() is used. It's a validator, but it's used like a getter or a normalizer.

Instead of this:

private function getId($key)
{
    return $this->namespace.CacheItem::validateKey($key);
}

Why not using it like this?

private function getId($key)
{
    CacheItem::validateKey($key);

    return $this->namespace.$key;
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This would just raise the boilerplate, whereas the current behavior keep it low IMHO.

@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.

4 participants