Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Cache] Handle arbitrary key length when the backend cant using hashing#20037

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromnicolas-grekas:cache-key-length
Sep 24, 2016

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedSep 23, 2016
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets-
LicenseMIT
Doc PR-

Saving some bits from#19521 :) Already awaited by PdoAdapter which defines the property.

return$this->namespace.$key;
}
if (strlen($id =$this->namespace.$key) >$this->maxIdLength) {
$id =$this->namespace.substr_replace(base64_encode(md5($key,true)),':', -2);
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Namespace excluded, this is always 23 chars long, trailing padding= removed.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The added trailing: is to prevent any collision between hashed keys and non-hasked keys.

CacheItem::validateKey($version);

if (!apcu_exists($version.':'.$namespace)) {
if (!apcu_exists($version.'@'.$namespace)) {
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Just because: is a nice separator for namespace, thus had to change here.@ looks good also for version :)

linaori reacted with laugh emoji
Copy link
Contributor

Choose a reason for hiding this comment

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

It's all about the looks ;)

protectedfunction__construct($namespace ='',$defaultLifetime =0)
{
$this->namespace ='' ===$namespace ?'' :$this->getId($namespace);
$this->namespace ='' ===$namespace ?'' :$this->getId($namespace).':';
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

: is a reserved char per psr6 so we use it internally to be free from any collision when concatenating keys and namespace later on

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commit11f448f intosymfony:masterSep 24, 2016
fabpot added a commit that referenced this pull requestSep 24, 2016
…ant using hashing (nicolas-grekas)This PR was merged into the 3.2-dev branch.Discussion----------[Cache] Handle arbitrary key length when the backend cant using hashing| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Saving some bits from#19521 :) Already awaited by PdoAdapter which defines the property.Commits-------11f448f [Cache] Handle arbitrary key length when the backend cant using hashing
@nicolas-grekasnicolas-grekas deleted the cache-key-length branchSeptember 29, 2016 10:06
@fabpotfabpot mentioned this pull requestOct 27, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@linaorilinaorilinaori left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@nicolas-grekas@fabpot@linaori@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp