Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Destory Persistent

Can anyone tell me how I can manually destory a persistent variable, either from my browser or the server?

I forgot to comment out the caching from the ACL plugin:

if (!isset($this->persistent->acl)) {

and now my app's a bit broken and I cannot render any controllers or their views. Can anyone help with this?



1.5k
Accepted
answer
edited Feb '15

You can follow the guideline here http://docs.phalconphp.com/en/latest/reference/acl.html#serializing-acl-lists

That is to serialize the Acl object and store in a text file, everytime you update your access control list rules, you can delete that file and the new Acl will be serialized and stored again.

//Check whether acl data already exist
if (!is_file("app/security/acl.data")) {

    $acl = new \Phalcon\Acl\Adapter\Memory();

    //... Define roles, resources, access, etc

    // Store serialized list into plain file
    file_put_contents("app/security/acl.data", serialize($acl));

} else {

     //Restore acl object from serialized file
     $acl = unserialize(file_get_contents("app/security/acl.data"));
}

@dzungcao awesome! Thanks for that, I also saw through the normal

$this->persistent

that the data is stored in APC so I'll set that up so I can flush it while I'm still working in a dev enviroment :)