I have a plugin that switches the template of the requested resource based on a $_REQUEST variable. This works
amazingly well for uncached resources. However, I would like it to support cached resources, as well.
I'm using both lines of code below:
$modx->getCacheManager()->refresh();
$modx->reloadContext($modx->context->key);
This works for cacheable resources, but not until I reload the page. It doesn't matter where I put the code. This will only be fired for graceful degradation, so its not a huge load on the system, but I do need it to work with cached resources. Any suggestions?
Additional Information:
The plugin fires on the OnLoadWebPage event. This means that the resource is found, but is not supposed to be parsed yet. This is definitely true, as the uncached pages work properly. It seems as if the cache refresh happens
after the event instead of during it.