core/Quick/Cache.php
public function method($class, $method, $args = array(), $ttl = null)
    {
        // Ensure that the class is a string
        is_string($class) or $class = get_class($class);

        $identifier = array(
            'class' => $class,
            'method' => $method,
            'args' => $args
        );

        // do we have the data cached already?
        $result = $this->driver->get_method($identifier);

        if ($result['status']) {
            // yep, we had it
            return unserialize($result['data']);
        }

        // no data found, run the method
        if (is_string($class)) {
            $object = new $class;
        }

        $data = call_user_func_array(array($object, $method), $args);

        $data_string = serialize($data);

        // now cache the newfound data and return it
        $this->driver->set_method($identifier, $data_string, $ttl);

        // if we are testing we drop out of "return the correct data at any cost mode" 
        // and instead make sure that our write was successful
        if ($this->strict) {
            $result = $this->driver->get_method($identifier);
            return unserialize($result['data']);
        }

        return $data;
    }
public function method($class, $method, $args = array(), $ttl = null)
    {
        // Ensure that the class is a string
        is_string($class) or $class = get_class($class);

        $identifier = array(
            'class' => $class,
            'method' => $method,
            'args' => $args
        );

        // do we have the data cached already?
        $result = $this->driver->get_method($identifier);

        if ($result['status']) {
            // yep, we had it
            return unserialize($result['data']);
        }

        // no data found, run the method
        if (is_string($class)) {
            $object = new $class;
        }

        $data = call_user_func_array(array($object, $method), $args);

        $data_string = serialize($data);

        // now cache the newfound data and return it
        $this->driver->set_method($identifier, $data_string, $ttl);

        // if we are testing we drop out of "return the correct data at any cost mode" 
        // and instead make sure that our write was successful
        if ($this->strict) {
            $result = $this->driver->get_method($identifier);
            return unserialize($result['data']);
        }

        return $data;
    }
public function method ( $ class , $ method , $ args = array ( ) , $ ttl = null ) { // Ensure that the class is a string is_string ( $ class ) or $ class = get_class ( $ class ) ; $ identifier = array ( 'class' => $ class , 'method' => $ method , 'args' => $ args ) ; // do we have the data cached already? $ result = $ this -> driver -> get_method ( $ identifier ) ; if ( $ result [ 'status' ] ) { // yep, we had it return unserialize ( $ result [ 'data' ] ) ; } // no data found, run the method if ( is_string ( $ class ) ) { $ object = new $ class ; } $ data = call_user_func_array ( array ( $ object , $ method ) , $ args ) ; $ data_string = serialize ( $ data ) ; // now cache the newfound data and return it $ this -> driver -> set_method ( $ identifier , $ data_string , $ ttl ) ; // if we are testing we drop out of "return the correct data at any cost mode"  // and instead make sure that our write was successful if ( $ this -> strict ) { $ result = $ this -> driver -> get_method ( $ identifier ) ; return unserialize ( $ result [ 'data' ] ) ; } return $ data ; }
Call a method, cache the result, and return the data

@param string|object $class  Either a namespace class or an object
@param string        $method The method to call
@param array         $args   The arguments to pass to the method
@param integer       $ttl    The time to live (seconds) will only be set on the first call for a method
@return
Call a method cache the result and return the data