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

Override stream cache path


While store cache in files, by default it splits the key to path with 2-chars for each dir. For ex., for key '1234567890' it will create deep path '12/34/56/78/90'.

What if we need to override this logic? I looked to the sources and noticed the functions needs to be overrided is private or final :( I mean Phalcon\Helper\Str::dirFromFile, Phalcon\Storage\Adapter\Stream::getDir...

What the 'phalcon way' to override this logic?

And what the reason to constrain such things so hard?

Thank you!

I would create my own adapter class by inheriting from https://github.com/phalcon/cphalcon/blob/master/phalcon/Storage/Adapter/Stream.zep and just override the getDir method