Skip to content

Platform cache #2

@thobens

Description

@thobens

The platform should be cached, so the platform has not to be built each request.

I would do it with serialize(), but there's one problem: serialize() can't handle PHP built-in objects like SimpleXMLElement etc.

To work around this, __sleep() and __wakeup() must be implemented in each class, that has PHP built-in objects as properties.

Example:
/*
* @var SimpleXMLElement
*/
$element

public function __construct() {
    $this->element = simplexml_load_string('<a b="c"><d e="f" /></a>');
}

public function __sleep() {
    $this->element = $this->element->asXml();
}

public function __wakeup() {
    $this->element = simplexml_load_string($this->element);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions