Do you have some feature in mind that you'd love to see in Couch? Let us know.
2 posts Page 1 of 1
Hi, @KK

It is beneficial for correctly set up MySQL server to cache database requests. But since couch has a seconds precision for publish date, caching such requests is not optimal. Instead, memory cache is filled with thousands of such trash (1) and more energy is wasted to find the same result set over and over again (2).

If publish date could be set with precision 'hour' then ideally during the whole hour, cache will be really helpful for websites with many visitors. 'show_future_entries' does not help to overcome, because the feature is lost and people use this to set publication date for tomorrow or in a week.

I don't see how seconds are ever needed in such situations. Nobody sets publication for tomorrow, 12h 01m 38s.

Feature request: set up precision to hours or days in any fit way.
Personally, I solved this with direct mod of source like this:

// Adjusts current server time using the provided offset
// to return the current desktop time (of the user).
function get_current_desktop_time(){ //+5.5 India
return gmdate( 'Y-m-d H:01:03', (time() + ((K_GMT_OFFSET+1) * 60 * 60)) );

This mod allows to make requests for the next hour (and 01m 03s) constantly. So, if page is just published now - it will be served and available. Also nicely cached by database.

(1) important repetitive sample, which now can be cached max for an hour and not recounted every second:
SELECT count( as cnt FROM couch_pages p WHERE p.template_id='2' AND p.publish_date < '2016-07-08 15:01:03' AND NOT p.publish_date = '0000-00-00 00:00:00'
unlimited time premium coding support per project - PM or email me or discuss in topic
active topics
Recently I was writing a query for the higher-than-average-load website and didn't want to rush change the core couch code. So, I am posting a simpler solution.

Code: Select all
    stop_before="<cms:date format='Y-m-d H:00:00' return='+1 hour' />"
    show_future_entries='1' >
            // your regular code here

The idea behind it is to instruct CouchCMS to override the date which it considers as current cut-off date to display published entries (with show_future_entries='1'). And once Couch serves pages with future dates, I am giving a second instruction - show pages with publish_date set as 1 hour from now (with rounded minutes and rounded seconds) (with stop_before).

So, if this query runs 100 times a minute, mysql database would return the cached result set immediately without performing the costly search of pages. And this cached result will be available till the time is re-set again to 1 hour (rounded) in future.

This has been possible with the use of extended <cms:date /> tag, found here - viewtopic.php?f=8&t=10559
More good stuff is in the "Long list of Tips&Tricks".
unlimited time premium coding support per project - PM or email me or discuss in topic
active topics
2 posts Page 1 of 1

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests