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

[Contracts] Add Cache contract to extend PSR-6 with tag invalidation, callback-based computation and stampede protection#28096

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:contract-cache
Sep 4, 2018

Conversation

@nicolas-grekas
Copy link
Member

@nicolas-grekasnicolas-grekas commentedAug 1, 2018
edited
Loading

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

Let's separate the useful interfaces of the Cache component in Contracts.
This does not includePruneableInterface,MarshallerInterface nor*AdapterInterface because they are too specific to the component.

ButCacheInterface,TawAwareCacheInterface andItemInterface form a nice consistent set of features on top of PSR-6.

Updating the Cache component to use these interfaces will be done in a separate PR so that we can focus on the contract itself here.

@nicolas-grekas
Copy link
MemberAuthor

Now with aGetForCacheItemPoolTrait to help implementing theCacheInterface::get() method in PSR-6 implementations.

@nicolas-grekas
Copy link
MemberAuthor

Also withExtendedCacheInterface +ExtendedTagAwareCacheInterface for pools implementing both intrefaces: the proposed ones + PSR-6'sCacheItemPoolInterface.

use Psr\Cache\CacheItemPoolInterface;

/**
* An interface that extends TawAwareCacheInterface with the methods from PSR-6's CacheItemPoolInterface.
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a typo:Taw =>Tag, also present in the PR description.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed thanks

*
* When implemented on a PSR-6 pool, invalidation should not apply
* to deferred items. Instead, they should be committed as usual.
* This allows replacing old tagged values by news ones without
Copy link
Member

Choose a reason for hiding this comment

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

new ones

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed, thanks

Copy link
Member

@NyholmNyholm left a comment

Choose a reason for hiding this comment

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

Great.
I had a discussion with@nicolas-grekas.
Approved with changes

/**
* An interface that extends TagAwareCacheInterface with the methods from PSR-6's CacheItemPoolInterface.
*/
interface ExtendedTagAwareCacheInterface extends TagAwareCacheInterface, CacheItemPoolInterface
Copy link
Member

Choose a reason for hiding this comment

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

As discussed: Remove this.

/**
* An interface that extends CacheInterface with the methods from PSR-6's CacheItemPoolInterface.
*/
interface ExtendedCacheInterface extends CacheInterface, CacheItemPoolInterface
Copy link
Member

Choose a reason for hiding this comment

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

We should remove this.

@nicolas-grekas
Copy link
MemberAuthor

Thanks@Nyholm , PR updated.

@Nyholm
Copy link
Member

Thank you. Im 👍

@nicolas-grekasnicolas-grekasforce-pushed thecontract-cache branch 5 times, most recently from09b706b tof7cad20CompareSeptember 4, 2018 06:46
@nicolas-grekas
Copy link
MemberAuthor

(rebased)

@nicolas-grekas
Copy link
MemberAuthor

Addressed, thanks.

… callback-based computation and stampede protection
interface CacheInterface
{
/**
* @param callable(ItemInterface):mixed $callback Should return the computed value for the given key/item
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

that's the declaration for the return type of the callable

interface CacheInterface
{
/**
* @param callable(ItemInterface):mixed $callback Should return the computed value for the given key/item
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

that's the declaration for the return type of the callable

@fabpot
Copy link
Member

Thank you@nicolas-grekas.

@fabpotfabpot merged commitca6478b intosymfony:masterSep 4, 2018
fabpot added a commit that referenced this pull requestSep 4, 2018
…g invalidation, callback-based computation and stampede protection (nicolas-grekas)This PR was merged into the 4.2-dev branch.Discussion----------[Contracts] Add Cache contract to extend PSR-6 with tag invalidation, callback-based computation and stampede protection| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Let's separate the useful interfaces of the Cache component in Contracts.This does not include `PruneableInterface`, `MarshallerInterface` nor `*AdapterInterface` because they are too specific to the component.But `CacheInterface`, `TawAwareCacheInterface` and `ItemInterface` form a nice consistent set of features on top of PSR-6.Updating the Cache component to use these interfaces will be done in a separate PR so that we can focus on the contract itself here.Commits-------ca6478b [Contracts] Add Cache contract to extend PSR-6 with tag invalidation, callback-based computation and stampede protection
@nicolas-grekasnicolas-grekas deleted the contract-cache branchSeptember 4, 2018 07:23
nicolas-grekas added a commit that referenced this pull requestSep 4, 2018
This PR was merged into the 4.2-dev branch.Discussion----------[Cache] leverage Contracts\Cache| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -Implementing#28096Commits-------0a1220f [Cache] leverage Contracts\Cache
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalasrchalasrchalasr left review comments

@fabpotfabpotfabpot approved these changes

@NyholmNyholmNyholm approved these changes

+1 more reviewer

@Cydonia7Cydonia7Cydonia7 left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

6 participants

@nicolas-grekas@Nyholm@fabpot@Cydonia7@chalasr@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp