Skip to content

Add craft config/cache as a console command #1607

@khalwat

Description

@khalwat

Something analogous to to the Laravel artisan config:cache would be really useful for production deployment: https://laravel.com/docs/master/configuration#configuration-caching

It could combine all of the craft/config files into one cached file for faster loading, and take all of the PHPdotenv settings and coalesce them into this cached config file so that it could be loaded quickly, without having to parse the .env for every request.

As per the PHPdotenv docs:

phpdotenv is made for development environments, and generally should not be used in production. In production, the actual environment variables should be set so that there is no overhead of loading the .env file on each request. This can be achieved via an automated deployment process with tools like Vagrant, chef, or Puppet, or can be set manually with cloud hosts like Pagodabox and Heroku.

This is a perfect type of thing to be added as a Craft console command via craft config/cache or such. If the cache file exists, great, use it, and don't parse anything in craft/config. If it doesn't exist, parse as normal.

You'd essentially just be preflighting something that's the same for every request, and eliminating unnecessary overhead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementimprovements to existing features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions