Persistence Container


Info

Short description The Persistence Container enables developers to hold objects, so-called beans, in memory whereby it is possible to define whether a bean will be a singleton, bound to a HTTP session or has no state at all. In addition to that, the Persistence Container allows you to make transparent use of a beans local or remote business interface. This allows application developers to implement independent, loose coupled, and reusable components that can be distributed across a network without the need change any source code.
Availability from 1.0.0
Type Main Module
Dependencies Appserver.io Runtime, Appserver.io
PSR https://github.com/appserver-io-psr/epb


Functions

Features
  • Support for singleton, stateless, stateful and message driven bean types
  • Lifecycle callbacks
  • Local and remote (network) business interfaces
  • DI support to inject Resources, Sessions and MessageDriven beans
  • AOP support for all bean types
  • Use annotations to configure beans
  • Override annotations by XML configuration
  • Supports HTTP for remote calls

Use Case

Nearly everybody who has been involved in development of an online shop system, neither for the own company or as project for a customer, has been faced the developers question: „How many products will be listed in the catalogue finally?“. The background of that question, in most cases, will be the problem that with a growing number of products the response time will become worse. This problem is partly a result of PHP's “shared nothing” paradigm. This paradigm makes it complicated to hold products, that has been loaded once, in memory and avoid to reload them on every request again and again. A workaround, that has been established in most PHP applications is the heavy usage of cache systems. At first sight, this solves the problem, but having a deeper look at the insights of many applications shows new problems that cache systems introduce. So massive usage of a cache system leads to the need to refresh to cached values, but the selective refreshing of cached data can be very complicated and will lead to critical mistakes in many cases. Using the Persistence Container offers the possibility to load objects into memory, which gives developers high performant access to them and avoids the usage of complicated cache systems in many cases.