JosephSilber / page-cache

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

How to set ttl time #75

Closed stridedot closed 3 years ago

stridedot commented 3 years ago

if I want to set the page expired after 10 minutes, How should I do?

JosephSilber commented 3 years ago

Since files are cached directly on disk, there's no built-in TTL.

You can easily add a schedule that calls php artisan page-cache:clear every 10 minutes:

$schedule->command('page-cache:clear')->everyTenMinutes();

While not exactly the same as a TTL, it'll ensure that nothing is ever cached for longer than 10 minutes.

stridedot commented 3 years ago

@JosephSilber thank you, that's a good idea! I closed the issue