mmikkel / CacheFlag-Craft

Flag and clear template caches
MIT License
36 stars 5 forks source link

Add support for console commands #17

Closed rungta closed 6 years ago

rungta commented 6 years ago

Initialises event listeners on console commands, thereby enabling cache busting if the current command modifies any elements.

(closes #16)

mmikkel commented 6 years ago

Thanks a lot for the PR! However, I think it's actually best to remove the check for the request type completely. The overhead introduced by those four calls to craft()->on() in CacheFlag's init method are theoretical, and I think it's a very good idea to have cache breaking available for any kind of request (e.g. anonymous, non-CP HTTP requests made via cURL to some custom controller). Check out v. 1.1.8 here!