protected function Cache($action, $filename, $data = '', $max_age = '')
    {
        if (!is_dir($this->cache_dir)) {
            return '';
        }

        // Set the full path
        $cache_file = $this->cache_dir . $filename;

        $cache = '';

        if ($action == 'get') {
            // Clear the file stats
            clearstatcache();

            if (is_file($cache_file) && $max_age != '') {
                // Make sure $max_age is negitive
                if (is_string($max_age) && substr($max_age, 0, 1) != '-') {
                    $max_age = '-' . $max_age;
                }

                // Make sure $max_age is an INT
                if (!is_int($max_age)) {
                    $max_age = strtotime($max_age);
                }

                // Test to see if the file is still fresh enough
                if (filemtime($cache_file) >= date($max_age)) {
                    $cache = file_get_contents($cache_file);
                }
            }
        } else {
            if (is_writable($this->cache_dir)) {
                // Serialize the Fields
                $store = serialize($data);

                //Open and Write the File
                $fp = fopen($cache_file, "w");
                fwrite($fp, $store);
                fclose($fp);
                chmod($cache_file, 0770);

                $cache = strlen($store);
            }
        }

        return $cache;
    }