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.
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
<cms:pages 
    masterpage='index.php'
    stop_before="<cms:date format='Y-m-d H:00:00' return='+1 hour' />"
    show_future_entries='1' >
            // your regular code here
</cms:pages>


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".
2 posts Page 1 of 1