0

I like being able to use the DI container in my extensions via the container hook, however I've run into the same problem a few times when switching branches that I get this error:

You have requested a non-existent service "myserviceid"

After trying drush cc all I'd expect the container cache to be clearer, but it doesn't seem to be. My go-to option is to remove all files in the sites/default/files/civicrm/templates_c/ directory, but this seems like it should be handled by the cache clear command.

I'm aware there's an option to not use a container cache, but my question is whether the failure to clear the container cache is expected, or should it be fixed?

1 Answer 1

1

You can clear the caches by running drush cc civicrm, by removing everything inside the templates_c directory, and by running clear caches in CiviCRM > Administer > System Settings > Cleanup Caches and File Paths.

In my experience, it's beneficial to run drush cc civicrm separately from drush cc all, which seems to clear only Drush and Drupal caches.

There is a bug reported about drush cc all not clearing CiviCRM caches: https://issues.civicrm.org/jira/browse/CRM-19206

6
  • I would expect all to include the CiviCRM cache, does it not? I remove files from templates_c manually and that works. I'm just confused by what is required to clear the container cache using drush, my expectation is that drush cc all should do it, but it doesn't seem to.
    – mickadoo
    Commented Nov 19, 2017 at 3:32
  • I think the issue is that it seems that you built something custom so you would need to add it to the drush script. I could be wrong, and if so, others will pipe in. Did you try drush cc civicrm?
    – Christia
    Commented Nov 19, 2017 at 3:34
  • drush cc civicrm also seems to fix it. Does this mean that the civicrm cache is not cleared as part of drush cc all, even though it is listed when you just do drush cc?
    – mickadoo
    Commented Nov 20, 2017 at 14:47
  • Updated my answer.
    – Christia
    Commented Nov 20, 2017 at 15:48
  • It seems like a bug that the civicrm cache is not fully cleared as part of drush cc all, especially since civicrm is listed as one of the cache options if you just do drush cc. I'll mark this as accepted, thanks.
    – mickadoo
    Commented Nov 28, 2017 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.