We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Saving persistent data

Is saving persistent data like an array of objects... in $this->persistent->myData in controllers is a good way , and is it stored in the RAM of the servers.


No it is saved in your session. You need to initialize session first to use $this->persistent.

for example:

class DictionaryController extends \Phalcon\Mvc\Controller
    public function indexAction()
        $this->persistent->testing_key = "my test value";

    public function showAction()
        echo "<pre>";

you get

    [_started] => 1
    [DictionaryController] => Array
            [testing_key] => my test value

Persistent makes Class name session key and add to it key=>value

edited Apr '14

in the tutorial of INVO project, in the Security Plugin, they saved the ACL in the $this->persistent. Which is the same for all users!