Doctrine File System Caching with Doctrine Cache Bundle

Some people had experience some difficulty configuring a filesystem cache type. Symfony by default comes with some caching because of the doctrine bundle, however if one wants to extend to more types one has to install the Doctrine Cache Bundle which brings more provides into place. Now if you want to still instruct doctrine to cache metadata, the results and the query caching with these service providers then this is the way:

doctrine:
    orm:
        metadata_cache_driver:
            type: service
            id: doctrine_cache.providers.vendor_filesystem_metadata_cache
        result_cache_driver:
            type: service
            id: doctrine_cache.providers.vendor_filesystem_result_cache
        query_cache_driver:
            type: service
            id: doctrine_cache.providers.vendor_filesystem_query_cache

doctrine_cache:
    providers:
        vendor_filesystem_metadata_cache:
            file_system:
                extension: cache
                directory: %kernel.root_dir%/cache/doctrine
        vendor_filesystem_result_cache:
            file_system:
                extension: cache
                directory: %kernel.root_dir%/cache/doctrine
        vendor_filesystem_query_cache:
            file_system:
                extension: cache
                directory: %kernel.root_dir%/cache/doctrine

I hope this resolves it for you when you need it.

2 thoughts on “Doctrine File System Caching with Doctrine Cache Bundle

Leave a Reply

Your email address will not be published. Required fields are marked *