function put($raw_key, &$value, $group = 'default')
  {
    $key = $this->_normalize_key($raw_key);

    $this->cache[$group][$key] =& $value;

    $file = $this->_get_cache_file_path($group, $key);

    fs :: safe_write($file, $this->_make_php_content($value));
  }
 function test_safe_write()
 {
   fs :: safe_write(VAR_DIR . '/test', 'test');
   $this->assertEqual('test',
                      file_get_contents(VAR_DIR . '/test'));
 }
Esempio n. 3
0
  function _save_cache()
  {
    $php = "<?php\n";
    $php .= '$charset = "' . $this->charset . '";' . "\n";
    $php .= '$group_values = ' . var_export($this->group_values, true) . ";\n";
    $php .= "\n?>";

    fs :: safe_write($this->cache_file, $php);
  }