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] Add nonce based cache invalidation to ApcuAdapter#18716

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-salt
May 12, 2016

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedMay 5, 2016
edited
Loading

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

APCu cache invalidation is tedious because it can't be done from the cli.
This PR adds and wires a nonce based cache invalidation strategy to work around this limitation.

}
}
foreach ($valuesas$id =>$v) {
$values[$id] =unserialize(substr($v,$this->nonceLen));
Copy link
Member

Choose a reason for hiding this comment

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

Why not moving this to the loop above?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Good question: because unserialization involves userland code, which means can be slow. But IMHO we need to invalidate fast.

@xabbuh
Copy link
Member

Having the nonce as a container parameter makes the APCu cache barely unusable in thedev environment where the container may be rebuilt quite often, doesn't it?

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedMay 6, 2016
edited
Loading

Except that our system caches (serializer & validation for now) are not enabled in debug mode.
Also, caches are registered with a clearer which means they are already cleared quite often in dev.

@nicolas-grekas
Copy link
MemberAuthor

I simplified the implementation to the very minimum so that no overhead is added anymore to each apcu_fetch/store. I also replaced the container parameter by an inline value for the nonce.

It has the drawback that@xabbuh outlined: the cachein dev is going to be cleared more often than strictly required. Yet I think this does not matter compared to the main benefit (we even already disable most caches in dev):

As you know, there is currently no way to invalidate an FPM/Apache apcu cache from the CLI, other than restarting FPM/Apache on deployment. Even if it's a best practice, not everyone is able to do it.
Nonce-based invalidation fixes this. Thus, it makes apcu usable againin prod for everyone, by default.

@dunglas
Copy link
Member

👍

@nicolas-grekas
Copy link
MemberAuthor

ping @symfony/deciders votes pendind for 3.1-beta which should/may be released tomorrow

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commita7899fe intosymfony:masterMay 12, 2016
fabpot added a commit that referenced this pull requestMay 12, 2016
…ter (nicolas-grekas)This PR was merged into the 3.1-dev branch.Discussion----------[Cache] Add nonce based cache invalidation to ApcuAdapter| Q             | A| ------------- | ---| Branch?       | 3.1| Bug fix?      | yes| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -APCu cache invalidation is tedious because it can't be done from the cli.This PR adds and wires a nonce based cache invalidation strategy to work around this limitation.Commits-------a7899fe [Cache] Add nonce based cache invalidation to ApcuAdapter
@nicolas-grekasnicolas-grekas deleted the cache-salt branchMay 12, 2016 20:52
@fabpotfabpot mentioned this pull requestMay 13, 2016
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@xabbuh@dunglas@fabpot@javiereguiluz@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp