We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

How to know all options of a function in API of PhalconPHP

I read docs from https://docs.phalcon.io/en/latest/api/Phalcon_Cache_Backend_File.html function shows like below:

public __construct (Phalcon\Cache\FrontendInterface $frontend, [array $options]) Phalcon\Cache\Backend\File constructor

=> there is an option is "cacheDir" there, so how can I know all of options of "[array $options]" if I can not open phalcon's source codes?

Thank you.


If I need check something I'm looking in 2.0 branch on github (https://github.com/phalcon/cphalcon/blob/2.0.0/phalcon/cache/) which is written in Zephir (the goal of 2.0 version is compatibility with 1.3 version). Zephir is more similar to PHP and I understand it more or less.

In Phalcon\Cache\Backend\File is only cacheDir option but File cache inherits by Phalcon\Cache\Backend which has also a prefix option.

edited Jun '14

Thank you very much.

Another relative question is :

if I has a config like below in services.php:

$di->set('cache', function(){ //Cache Data $frontCache = new Phalcon\Cache\Frontend\Data(array( 'lifetime' => 2592000 )); $cache = new Phalcon\Cache\Backend\File( $frontCache, array( 'cacheDir' => DIR.DS.'..'.DS.'dirwritable'.DS.'cache'.DS.'queries'.DS, 'prefix' => 'query_' ) ); return $cache; });

I use $this->cache-> ... to create cache, and everything works fine.

But how can I change "cacheDir" option from inside controller? it's protected !!!

Phalcon\Cache\Backend\File Object ( [_frontend:protected] => Phalcon\Cache\Frontend\Data Object ( [_frontendOptions:protected] => Array ( [lifetime] => 2592000 )


[_options:protected] => Array
        [cacheDir] => N:\myp\nc\app\config\..\dirwritable\cache\queries\
        [prefix] => query_

[_prefix:protected] => query_
[_lastKey:protected] => 
[_lastLifetime:protected] => 
[_fresh:protected] => 
[_started:protected] => 


Thanks in advance.

I think that Cache are not designed to changing any option after creation of cache instance.


Thanks for info