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

Package doesn't record views when Response Cache is used #81

Closed
izakibikas opened this issue Jul 6, 2018 · 2 comments
Closed

Package doesn't record views when Response Cache is used #81

izakibikas opened this issue Jul 6, 2018 · 2 comments

Comments

@izakibikas
Copy link

  • Laravel Version: 5.5
  • PHP Version: 7.1.7

When this package is used https://github.com/spatie/laravel-responsecache to cache entire response (for speed), page views are only recorded for the first time. as the next request will provide response from the cache, the page views are not recorded. Is there any workaround this?

@cyrildewit
Copy link
Owner

I don't think this is possible. It looks like the response cache package caches the whole page content and doesn't run any controller code. You could try to hack around with the triggered events, but I would personally turn it off using the doNotCacheResponse route middleware for that page.

@izakibikas
Copy link
Author

Well, using doNotCacheResponse is not an option for me as page load speed is significantly faster when caching response.
I have worked this around by adding an ajax request at page load that just runs the function addPageViews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants