Changes to the CacheManager in MODX3?

I tried to make the Gallery extra work in MODX3, but encountered some issues with the cache.

In MODX 2.x these lines

clear the whole directories (core/cache/default/gallery/album/list, etc.), but in MODX3 they don’t.

The problem seems to be, that the default value for “multiple_object_delete” has changed.

In 2.x the default value (third parameter) is true.

In 3.x the default is false.

Is this a bug or a deliberate change in behaviour?

Good question. The only related commit message I found was this:

Fix xPDOFileCache->delete() and invalid calls to cacheManager->deleteTree()

But it’s from 2011, and the commit doesn’t change that value.

You can see why this was changed in this PR:

This was also changed for 2.x at the same time…

Thanks, for the links.

But my question is, why the default value is different for the 2 branches.
If ‘multiple_object_delete’ is not specified in the $options array, then it’s default value is true in 3.x and false in 2.x which leads to inconsistent behavior between the branches.

2.x → third parameter for getOption() is true:

if ($this->getOption('multiple_object_delete', $options, true)) {

3.x → third parameter for getOption() is false:

if ($this->getOption(xPDO::OPT_CACHE_MULTIPLE_OBJECT_DELETE, $options, false)) {

This comment is the only explanation I can offer…

1 Like