-
Notifications
You must be signed in to change notification settings - Fork 41
WORKER SERVICE and WORKER OBJECT
This kind of SERVICE that must satisfy folling conditions:
-
singleton. A singleton service is made by by Illuminate\Containe\Application::singleton() or Illuminate\Containe\Application::instance()
-
its vars should restore if a change made in a request and harm the next request
-
if it has ref attibutes, like app['events'] has an attribubte
container
, the attribute container must be also A WORKER SERVICE.
If a singleton service does not satisfy the second condition, you can try refactor.
If you use coroutine in your code, it must be also a COROUTINE-FRIENDLY SERVICE.
-
its vars will not change in any requests
-
if it has ref attibutes, like app['events'] has an attribubte
container
, the container must be also A COROUTINE-FRIENDLY SERVICE
There are two Traits LaravelFly\Map\Util\Dict
and LaravelFly\Map\Util\StaticDic
used by LaravelFly to make a service to be a WORKER SERVICE or COROUTINE-FRIENDLY SERVICE. The first trait handles non-static vars, while the second static vars.
There two simple examples which make Laravel's official service coroutine-friendly.
service | official | refactor |
---|---|---|
app['event'] | Illuminate\Events\Dispatcher | LaravelFly\Map\IlluminateBase\Dispatcher |
app['translator'] | Illuminate\Translation\Translator | LaravelFly\Map\Illuminate\Translation\Translator |
service | official | refactor |
---|---|---|
app() | Illuminate/Foundation/Application.php | LaravelFly-fly-files/src/Application.php |
refactor can work on any other objects like a WORKER SERVICE.
object | official | refactor |
---|---|---|
Facade | Illuminate/Support/Facades/Facade | LaravelFly-fly-files/src/Facade.php |
- Start
- Coding Guideline
- Deploy and OS Configuration
- New API
- Design
- Dev about Mode Map
- Dev about Mode Backup