News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Dave Gardner's Blog:
Caching dependency-injected objects
March 25, 2010 @ 11:49:57

Dave Gardner has posted about a method he uses to cache objects that have dependency injection needs in something like a memcached server.

The objects themselves have a number of injected dependencies. It includes using the PHP magic methods __sleep and __wakeup to manage serialisation. It also discusses mechanisms for re-injecting dependencies on wakeup via a method that maintains Inversion of Control (IoC).

He uses a user object based example that has an injection needed to load in the user's usage history. He includes the code to define the classes, create the objects via a dependency injection container and performing the sleep/wakeup actions with the dependencies coming out intact on the other side.

0 comments voice your opinion now!
tutorial cache dependency injection object sleep wakeup


blog comments powered by Disqus

Similar Posts

IBM developerWorks: Developing PHP the Ajax way, Part 1 - Getting started

NetTuts.com: How To Display Post Meta Data on a WordPress Post

DevShed: Polymorphism, Design Patterns, and PHP Programming

Phish Tank: Install & Configure Apache+PHP+ZendFramework+OracleDbXe On Windows In Minutes

Sam Hennessy's Blog: A Dependency Injection for PHP Manifesto - Part 1 (What I Want)


Community Events





Don't see your event here?
Let us know!


podcast security series package opinion introduction mvc community interview language tool version framework release library update symfony voicesoftheelephpant laravel composer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework