rosswintle / turbo-admin

WordPress Command Palette
11 stars 1 forks source link

Improve menu item caching strategy #18

Open rosswintle opened 2 years ago

rosswintle commented 2 years ago

Further to discussion in #17, can we improve the caching strategy for items?

Currently, Turbo Admin load menu items when on the back-end and cache them for use on the front end. It load-and-caches on every back-end page load. Which is kinda wasteful.

It would be good to be able to detect when menu items have changed and only re-cache at that point?

What causes menu items to change? Here are the things I know about off the top of my head:

I already detect log in and log out.

Activate/deactivate plugin could be done by inspecting the URL of the page, as this always triggers a page reload.

The special case of edit/view post would have to be considered somehow.