Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Useful metrics for people using 'expire cache' #615

Closed
wolispace opened this issue Jan 25, 2024 · 6 comments
Closed

Useful metrics for people using 'expire cache' #615

wolispace opened this issue Jan 25, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@wolispace
Copy link

For us using the 'Expire caches' mode, it would be useful to see a new entry in Blitz Diagnostics:

nnn Expired caches

Click on that to see the list from a query like this:
select id,siteId,uri, date_add(expiryDate, interval 630 minute) as expiryDateADL, now() from blitz_caches where expiryDate is not null order by uri;

I find this query useful to see which pages have expired caches and converting them to my local timezone (not sure how that would be done in craft using user preferences).

I'm also curious, and would like to see select count(*) from blitz_caches where expiryDate is null to so I can get a sense of it growing as compared to the file system. Maybe not all that useful for others tho :-)

Talking of stats, it would be great to see a log of each entry that was refreshed due to an expired cache and if a cron job or an organic query refreshed it.

@wolispace wolispace added the enhancement New feature or request label Jan 25, 2024
@bencroker
Copy link
Collaborator

Thanks for the suggestion, I'll consider adding this in a future release.

Talking of stats, it would be great to see a log of each entry that was refreshed due to an expired cache and if a cron job or an organic query refreshed it.

What exactly would be the benefit of this, and what do you imagine the UI looking like?

@bencroker
Copy link
Collaborator

bencroker commented Jan 27, 2024

Rather than add an entire new section, I’ve opted to add an expiry date column and a dropdown field that allows you to filter tracked pages by whether they are expiring (in the future) or expired (in the past). What do you think of this approach?

Screenshot 2024-01-27 at 09 06 21

@wolispace
Copy link
Author

This is a great solution.

Just sorting by expiryDate should suffice: it's either null or on a date spectrum from past to future.

Is/can that date be adjusted to show relative to the users timezone? Makes tracking down why a page has not been refreshed (failed cron job or some other reason) much easier than having to lookup UTC time conversions all the time :-)

@bencroker
Copy link
Collaborator

Just sorting by expiryDate should suffice: it's either null or on a date spectrum from past to future.

Agreed. I’ve removed the filter.

Is/can that date be adjusted to show relative to the users timezone?

Yes, I’ve made it so the date is localised.

You can test this by running composer require "putyourlightson/craft-blitz:dev-develop as 4.10.4".

@wolispace
Copy link
Author

Magnifique!

This makes it so easy to see whats going on with the expired caches.

Our challenge now is to work out why some are not getting expired.. but thats not part of this issue/request.

Close and merge or whatever fun things you need to do to get this into production.

Thanks

@bencroker
Copy link
Collaborator

Released in 4.11.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants