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

Static version of the library and other things? #4

Open
beppe9000 opened this issue Nov 29, 2018 · 0 comments
Open

Static version of the library and other things? #4

beppe9000 opened this issue Nov 29, 2018 · 0 comments

Comments

@beppe9000
Copy link

beppe9000 commented Nov 29, 2018

I think it could be cool to be able to do oneliners like this, with static methods:

if (\Dorantor\FileLock::acquire('path')){

  //do work...

\Dorantor\FileLock::release('path');
}

Also fluent locking with closures:

\Dorantor\FileLock::lock('/path/file')->acquired(function(){echo("HELLO FROM LOCK!");});

\Dorantor\FileLock::lock('/path/file')->failure(function(){echo("LOCK NOT ACQUIRED!");});

\Dorantor\FileLock::lock('/path/file')->acquired(function(){echo("HELLO FROM LOCK!");})->failure(function(){echo("LOCK NOT ACQUIRED!");});
@beppe9000 beppe9000 changed the title Static version of the library? Static version of the library and other things? Nov 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant