ignition icon indicating copy to clipboard operation
ignition copied to clipboard

Feat flush view data

Open viest opened this issue 3 years ago • 2 comments

The view data keeps appending causing memory to increase.

For example.

There is a timed task to send emails, I send 100 emails with different data, the view data length will be 100, the data volume is large but the memory is relatively small, it can easily lead to killed.

Add a method to clean up view data, users can clean up unnecessary data by themselves to protect memory.

for ($index = 0; $index < 100; $index++) {
    /* @var Factory $viewFactor */
    $viewFactor = Mail::getViewFactory();

    $view = $viewFactor->make('email.view', [
        // big data......
    ]);

    // get html
    $data = $view->render();

    /* @var CompilerEngine $viewEngine */
    $viewEngine = $view->getEngine();
    $viewEngine->flushViewData();

    // send mail via raw data
    // ......
}

viest avatar Feb 25 '22 16:02 viest

Could you also document this function in the readme?

freekmurze avatar Feb 27 '22 19:02 freekmurze

I described what the function does through comments, does this meet your requirements?

viest avatar Feb 28 '22 02:02 viest