auraphp / Aura.Di

Dependency Injection System
MIT License
349 stars 63 forks source link

Make it possible to serialize the Aura.Di container #79

Closed brandonsavage closed 9 years ago

brandonsavage commented 9 years ago

@pmjones This should make caching possible.

brandonsavage commented 9 years ago

FWIW this improves the performance of Aura.DI 25% with APC. But it has the drawback that closures cannot be serialized.

harikt commented 9 years ago

@brandonsavage https://github.com/jeremeamia/super_closure , may caching can be made to a separate bundle ? if we could not bring super_closure ?

brandonsavage commented 9 years ago

It was @pmjones desire to make caching possible with the DI container. Assuming that nobody uses a closure for constructing their components, they can serialize the container with this change. We can make it a known issue that closures can't be serialized, and let users make their own decisions.

On Thu, Jan 1, 2015 at 9:09 PM, Hari K T notifications@github.com wrote:

@brandonsavage https://github.com/brandonsavage https://github.com/jeremeamia/super_closure , may caching can be made to a separate bundle ? if we could not bring super_closure ?

— Reply to this email directly or view it on GitHub https://github.com/auraphp/Aura.Di/pull/79#issuecomment-68505696.

harikt commented 9 years ago

@brandonsavage I don't know whether that is true for all. But in my case I am using. Eg : https://github.com/cocoframework/Cocoframework.Web_Project/blob/caf49b6e3398bbabe9a664a680b3826438271c0a/config/Common.php#L48-L50 as asked at https://groups.google.com/d/msg/auraphp/myU1o4dkYsU/eu_GfO4qvtYJ

brandonsavage commented 9 years ago

The fact that one feature of Aura might not be compatible with another surely isn't a reason to not do it. In your case you simply wouldn't serialize. If Aura's components are truly decoupled then what we do here and what we do there should be independent decisions.

If developers need closures we can point them in the direction of SuperClosure.

Sent from my iPhone

On Jan 1, 2015, at 22:55, Hari K T notifications@github.com wrote:

@brandonsavage I don't know whether that is true for all. But in my case I am using. Eg : https://github.com/cocoframework/Cocoframework.Web_Project/blob/caf49b6e3398bbabe9a664a680b3826438271c0a/config/Common.php#L48-L50 as asked at https://groups.google.com/d/msg/auraphp/myU1o4dkYsU/eu_GfO4qvtYJ

— Reply to this email directly or view it on GitHub.

harikt commented 9 years ago

The fact that one feature of Aura might not be compatible with another surely isn't a reason to not do it

Sorry if you misunderstood me. I was not saying don't do it. I was talking about the issues that can happen.

Thanks!

pmjones commented 9 years ago

Fails on 5.3 but whatever, I can clean that up.