JosephSilber / page-cache

Caches responses as static files on disk for lightning fast page loads.
MIT License
1.21k stars 118 forks source link

Suggestions: no-page-cache route middleware and PAGE_CACHE_ENABLED env variable #40

Closed bridgeport closed 4 years ago

bridgeport commented 5 years ago

Thanks for this package. Three suggestions:

1) Add a PAGE_CACHE_ENABLED environment variable with supporting config file that checks for this. This allows the cache to be turned on and off instead of having to comment out the reference in Kernel.php

2) You have a page-cache route middleware, but how about doing the inverse: a no-page-cache middleware? This'll allow an individual route(s) to be excluded easily while caching everything else by default.

3) Regex cache clearing. Right now, an individual slug can be cleared:

php artisan page-cache:clear {slug}

But what about extending it to clear a directory, like so:

php artisan page-cache:clear country/canada/*

Or just clearing anything that matches:

php artisan page-cache:clear country/canad*

If full-blown regex is too much work to do, at least supporting the asterisk seems to be a reasonable middle ground.

Thanks.

KodeStar commented 4 years ago

There is already a PR that was submitted nearly a month ago that will recursively delete a directory, just waiting for it to be merged. https://github.com/JosephSilber/page-cache/pull/58

JosephSilber commented 4 years ago