0

I'm testing the cacheAPI with a custom bin. Everything is working. On the other hand, while testing, I created a custom bin with a name that does not suit me.

cache.lorem_bin:
  class: Drupal\Core\Cache\CacheBackendInterface
  tags:
    - { name: cache.bin }
  factory: ['@cache_factory', 'get']
  arguments: [lorem_bin]

A table in DB cache_lorem_bin was created.

So I modified it and another table was created with the name of this new custom bin. But the old table cache_lorem_bin was not deleted even after clearing the cache. I don't see in the documentation how to delete this table. It's not blocking but I would like to know how to do it.

1 Answer 1

1

Cache bin tables are automatically removed when you uninstall the module. You should have uninstalled the module before making the change and after that install the module again.

However, as a developer you can choose to drop the table manually to avoid the reinstall process. The new cache bin table will be created the first time it is used.

3
  • Uninstalling the module did not delete the tables. I deleted them manually as you told me and everything is ok. I had quite a few and it's much cleaner. May 5, 2023 at 10:06
  • You have to uninstall the old version before the change. It only deletes tables that are still defined in code.
    – 4uk4
    May 5, 2023 at 11:21
  • Thank you, indeed, that's right and it makes sense. May 5, 2023 at 14:13

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.