trilbymedia / grav-plugin-git-sync

Collaboratively Synchronize your Grav `user` folder hosted on GitHub, BitBucket or GitLab
Apache License 2.0
243 stars 58 forks source link

clear cache after pulling changes #193

Closed drzraf closed 3 years ago

drzraf commented 3 years ago

Happens that after a pull, cache is not cleared which is a problem for cache-enabled Grav instances.

mahagr commented 3 years ago

I wouldn't clear all the cache, I'd just invalidate it causing recalcs.

drzraf commented 3 years ago

Sample case: I updated the a form field and pushed. After git-sync pulled, the public (cached) page's form wasn't updated.

mahagr commented 3 years ago

Changing twig is a special case, it always needs twig cache clear.

w00fz commented 3 years ago

I don't think git sync should be the one in charge of making the decision about clearing cache or not. Clearing cache follows a flow that rarely you want to disrupt. Either cache expires naturally or user manually forces the clearing. Plugins that automatically clear cache are rare and they really need to have obvious reasons for that, I don't think GitSync should be in charge of this.

However, you could totally hook into GitSync gitsync event and manually trigger a Cache Clear. That would fall under the 'user manually forcing a clear cache' category. If you had it as a very simple plugin, then you could transport this project to project depending on the need.

mahagr commented 3 years ago

I agree. There's no way to know what is being synced and large changing sites may become unusable if you clear too much of the cache on every pull.