Results 1 to 3 of 3

Thread: Dose vshare support QuickCache

  1. #1
    Join Date
    Oct 2010
    Posts
    29

    Default Dose vshare support QuickCache

    QuickCache is a lightweight, full page caching system for PHP. QuickCache reduces server load by as much as 80% since pages are generated less often. It dramatically speeds up the serving of pages, by caching the ouput of pages and returning cached versions instead of newly compiling the page.

    Worx International Inc.

    Dose vshare support QuickCache?
    Or there is a better php cache program?

  2. #2
    Join Date
    Sep 2007
    Posts
    906

    Default

    vshare don't have this. Vshare have Zend_Cahe with default file backend.

    You can use

    Memcached
    Apc
    Xcache
    vShare Hosting, vShare Installation, Server Setup, Lighttpd streaming, vShare Templates
    [email protected]

  3. #3
    Join Date
    Oct 2010
    Posts
    29

    Default

    I am using Memcached and i will put all my heavy load pages with this code.

    PHP Code:
    <?
    ////////////////////////////////////////////////////////////////
    // index.php
    //
    // This is an example of memcaching a full static page
    ////////////////////////////////////////////////////////////////

    // This is the page you want to cache
    $url = "http://www.mysite/mydynamicpage";

    // This function grabs the HTML of the page
    function ScrapePage () {
        global $url;

        $ch = curl_init();    // initialize curl handle
        curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
        curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
        curl_setopt($ch, CURLOPT_POST, 1); // set POST method
        curl_setopt($ch, CURLOPT_POSTFIELDS, ""); // add POST fields
        $result = curl_exec($ch); // run the whole process
        curl_close($ch); 
        return $result; 
    }

    // This function stores the HTML into memcache and update if its older than 3 mins
    function MemCacheFunction($function_name)
    {
        $memcache = new Memcache;
        $memcache->connect('localhost', 11211) or die ("Could not connect");
        
        $memcache_key = md5('sometextkey'.$function_name);
        if ( $memcache_result = $memcache->get($memcache_key) )
        { 
            //echo "It Worked!";
            return $memcache_result;
        }   
        //echo "Couldn't Find Key: ".$memcache_key;
        $ret = '';
        $ret .= $function_name();
        $memcache->set($memcache_key, $ret, false, 180);

        return $ret;
    }

    // A simple condition determines whether to load page from Memcache or process the dynamic page 
    if ($_COOKIE["loggedin"] == "yes") {
        include ("index_dynamic.php");
    } else {
        echo MemCacheFunction("ScrapePage");
    }
    ?>
    But my problem is how i will call my dynamic page when a user is logged in.

    example:
    PHP Code:
    if ($_COOKIE["loggedin"] == "yes") {
        include (
    "index_dynamic.php"); 
    Thank you

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •