public function setCache(array $data)
    {
        $handle = $this->handle;

        $rows = $handle->query('SELECT created FROM `' . $this->config['table'].'`');

        if (!$rows || $rows->rowCount() === 0) {

            $this->write($handle, $data);
        } else {

            foreach ($rows as $row) {

                if ((time()-strtotime($row['created'])) >
                    $this->config['expiration_time']) {

                    $this->write($handle, $data);
                }
            }
        }

        return $this;
    }
public function setCache(array $data)
    {
        $handle = $this->handle;

        $rows = $handle->query('SELECT created FROM `' . $this->config['table'].'`');

        if (!$rows || $rows->rowCount() === 0) {

            $this->write($handle, $data);
        } else {

            foreach ($rows as $row) {

                if ((time()-strtotime($row['created'])) >
                    $this->config['expiration_time']) {

                    $this->write($handle, $data);
                }
            }
        }

        return $this;
    }
public function setCache ( array $ data ) { $ handle = $ this -> handle ; $ rows = $ handle -> query ( 'SELECT created FROM `' . $ this -> config [ 'table' ] . '`' ) ; if ( ! $ rows || $ rows -> rowCount ( ) === 0 ) { $ this -> write ( $ handle , $ data ) ; } else { foreach ( $ rows as $ row ) { if ( ( time ( ) - strtotime ( $ row [ 'created' ] ) ) > $ this -> config [ 'expiration_time' ] ) { $ this -> write ( $ handle , $ data ) ; } } } return $ this ; }
Writes cache data into the database

@param array $data the caching data

@throws PDOException if a db error occurred
@return object       $this
Writes cache data into the database