Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
3 posts Page 1 of 1
Cache is a very nice feature, which serves pregenerated html files, makes pages load lightning fast, does not call any tags and mysql. Basically, serving a static page.

Cache can be enabled/disabled in /couch/config.php
define( 'K_USE_CACHE', 1 );


I'm quoting @KK here below with even more details about caching. It might save a lengthy answer in future. I personally found something new in it.
______________________

Basically Couch employs a very simple kind of caching strategy.
Following is some pseudo-code of the process -

Code: Select all
if( caching is on ){

    if( user is not logged-in AND has explicitly not asked to bypass cache){ // by appending 'nc=1' to the URL the cache can be bypassed
   
        if( the current URL is in cache ){ // a file with the name of the current URL's MD5 hash is searched in cache
       
            if( the cache has not been busted ){ // any 'save' has not been done to *any* page after this file was cached
                return this cached file // execution ends here
            }
           
        }
    }
}

//if we are here, either the user was logged in, or an unlogged user had used 'nc=1' or the current URL was not in cache ..
// process request normally (i.e. parse template and send back whatever was outputted)

output = parse_template() // i.e run all Couch tags to get the final output

if( caching is on ){

    if( <cms:no_cache /> was not found anywhere in the template just parsed ){
        cache_output() // save it as a file named with the MD5 of the current URL
    }
   
}

return output // end of execution


I think that should give you an over-all view of the process.
Wow great explanation! :D
Now i understand how couch's cache work!

Nice job green lantern squad!
As soon as possible!

Touch me up : abada[dot]zulma[at]gmail[dot]com
What it the correct strategy to use cache with sorting/display options? For example, a list of pages can be loaded with 10/25/100 items per page and setting for a pagecount stays now in session. Shall I move this from session to url with querystring to make so the cache properly recognizes the page?

website.com/blog.php&pg=5 with 10 posts per page has different content from the same paginated url if it's 100 posts per page. Should _all_ sorting/view options be included in url for the cache being properly used? Number of parameters can be big, including list/grid views, sort AzzA, date, price etc..

Thanks!
3 posts Page 1 of 1

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 1 guest