Skip to content
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

[Lock][Semaphore] Add Factory::createFromKey and deprecate lock.store services #38593

Merged
merged 1 commit into from Oct 16, 2020

Conversation

jderusse
Copy link
Member

@jderusse jderusse commented Oct 15, 2020

I| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | yes
| Tickets | /
| License | MIT
| Doc PR | todo

The lock service and aliases have been deprecated in #38576. This PR also deprecate the lock.store service and aliases.

People should always inject the factory into their services, except for one scenario: When they want building the Lock manually because they want to keep the key.

This scenario require declaring lock.store service and PersisingStoreInterface aliases.
This could be avoided if people had a method to create a lock from a given key.

This PR adds a LockFactory::createFromKey() method and deprecate all lock.store services

I also updated the Semaphore component for consistency, and helping people to only inject the SemahoreFactory.

nb: use cases for serializing the keys:

  • Netflix allows only 5 users of the same family at the same time.
  • An holiday apartment rental avoid users putting the same apartment in the basket
  • ...

@fabpot
Copy link
Member

fabpot commented Oct 16, 2020

Thank you @jderusse.

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.

None yet

4 participants