Rediscache x post views


#1

Hello, It has a template in wp, which has a plugin that shows how many views of each post.

My site uses easyengine + wp + rediscache

I have a problem, when the user accesses the site and does not show how views are available, the counter is stuck and does not update because of the cache.

I would like to know how do I redis cache not cache this plugin


#2

You can set:

set $skip_cache 1;

to any location you don’t want to be cached. See the “/etc/nginx/common/redis.conf” for example.

In your scenario, maybe you can exclude the whole plugin folder.


#3

How do I set this tables to wp_pvc_daily and wp_pvc_total

When redis caches the page or the user is not logged in, he could not see the updated post views


#4

If you care to look in the “/etc/nginx/common/redis.conf” file , you will notice that the rule to skip cache is this:

if ($request_uri ~* “(/the-url-or-folder-to-your-plugin-or-the-file-that-is-displaying-the-updated-post-views)”) { set $skip_cache 1; }

put this rule in /var/www/domain.com/conf/nginx/new-file-any-name-you-choose.conf


#5

Still does not show updated views I already put up the url of a page, but the cache still does not show the updated views

Only refreshes when I give a flush cache


#6

What’s the name of the plugin? Maybe I could give it a try.


#7

#8

Add this to your /var/www/domain.ltd/conf/nginx/anyname.conf and reload nginx, clean cache.

if ($request_uri ~* "(/wp-json/pvc/v1/increase/1)") {
set $skip_cache 1;
}

I installed the plugin and only change “Page Views Count Load” to enable Ajax load. It should be working.


#9

Hello, excuse me for delaying the response.

Everything worked fine here, but only works with pages In the post does not work

If I leave the site url

Example.com//2017/06/06/post-exemple/ the counter does not work

Now if I enable the permanent links to Http://www.example.com/?p=123 The counter works 100% with the cache

Would there be any way for me to sort it out?


#10

I tested it on a clean install of WordPress with --wpredis --php7 flags, and permalink enabled (/sample-post).

Maybe you should contact the plugin’s author. He/she should know better how the plugin work and which resource to exclude from caching.


#11