overblog / GraphQLBundle

This bundle provides tools to build a complete GraphQL API server in your Symfony App.
MIT License
783 stars 221 forks source link

Use Symfony cache adapter #1093

Closed AlexOstrovsky closed 1 year ago

AlexOstrovsky commented 1 year ago
Q A
Bug report? no
Feature request? yes
BC Break report? no
RFC? no
Version/Branch 0.15.2

Would it be possible for this bundle to use Symfony app cache adapter instead of always files? e.g. when I define app: cache.adapter.redis then also cache from this bundle will be in Redis?

Vincz commented 1 year ago

Hi @AlexOstrovsky. I don't think it would be that easy. The way it works currently is by generating a bunch of classes to store the config of the GraphQL objects. The path of the cache folder is added to the autoloader so PHP is able to autoload the related classes. If you were to use a different adapter, you would have to create an autoloader able to load your generated PHP classes from the cache adapter and I don't know if it's even possible (or maybe with eval, I'm not sure).

AlexOstrovsky commented 1 year ago

Thank you @Vincz for swift reply. I will have to then create shared volume between our docker pods so they can generate cache in initContainer and share this cache.