本文整理汇总了PHP中FileCache::save方法的典型用法代码示例。如果您正苦于以下问题:PHP FileCache::save方法的具体用法?PHP FileCache::save怎么用?PHP FileCache::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileCache
的用法示例。
在下文中一共展示了FileCache::save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __destruct
/**
* In destructor saving getting data to cache - file
*/
public function __destruct()
{
if (!is_null($this->cache)) {
$this->cache->stops = $this->stops;
$this->cache->departures = $this->departures;
$this->cache->spoje = $this->spoje;
$this->cache->form_url = $this->form_url;
$this->cache->categories = $this->categories;
$this->cache->save();
}
}
示例2: updateFileInCache
/**
* Updates file in cashe. Even if it already in it.
* @param $fileitentifier
*/
public static function updateFileInCache($fileitentifier) {
$path = FileModification::createDirectory('filecache');
$path = FileModification::createDirectory('filecache/'.Yii::app()->user->clientID);
if (is_file($fileitentifier)) {
//if this if image from filesystem
//convert to pdf
$result_file_array = FileModification::PdfByFilePath($fileitentifier);
$filepath = $result_file_array['filepath'];
$filename = $result_file_array['filename'];
$path_to_base = $filepath;
$fileId = sha1_file($filepath).sha1($filepath);
} else {
//if this is image from database
$image = Images::model()->findByAttributes(array(
'Document_ID' => intval($fileitentifier)
));
if($image) {
$mime = explode('/', $image->Mime_Type);
$temp_file_path = $path . '/' . $image->File_Name;
$infile = stripslashes($image->Img);
file_put_contents($temp_file_path, $infile);
$fileId = intval($fileitentifier);
$path_to_base = $temp_file_path;
}
}
FileCache::deleteFromCacheById($fileitentifier);
FileCache::deleteFromCacheById($fileId);
$fileCash = new FileCache();
$fileCash->file_id = $fileId;
$fileCash->path = $path_to_base;
$fileCash->client_id = Yii::app()->user->clientID;
$fileCash->user_id = Yii::app()->user->userID;
$fileCash->Created = time();
$fileCash->save();
$result_id = $fileCash->file_id;
return $result_id;
}
示例3: save
/**
* @param string $key
* @param mixed $value
* @return void
* @throws FileOpenFailedException
* @throws FileWriteFailedException
*/
public function save($key, $value)
{
$this->memoryCache->save($key, $value);
$this->fileCache->save($key, $value);
}
示例4: initialize
/**
* This initialize those include path.
*
*/
public static function initialize()
{
//this is set for FileCache usage
$root = PathService::getRootDir();
$configFile = $root . DIRECTORY_SEPARATOR . "config" . DIRECTORY_SEPARATOR . "config.ini";
if (file_exists($configFile)) {
set_include_path(get_include_path() . PATH_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . "cache");
if (!is_null(FileCache::get(self::FILECACHE))) {
set_include_path(FileCache::get(self::FILECACHE));
return;
}
}
set_include_path(get_include_path() . PATH_SEPARATOR . "core");
set_include_path(get_include_path() . PATH_SEPARATOR . "config");
set_include_path(get_include_path() . PATH_SEPARATOR . "app");
set_include_path(get_include_path() . PATH_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "library");
set_include_path(get_include_path() . PATH_SEPARATOR . "project");
set_include_path(get_include_path() . PATH_SEPARATOR . "project" . DIRECTORY_SEPARATOR . "share");
set_include_path(get_include_path() . PATH_SEPARATOR . "project" . DIRECTORY_SEPARATOR . "modules");
set_include_path(get_include_path() . PATH_SEPARATOR . "plugin");
//set module paths
$modulePath = $root . DIRECTORY_SEPARATOR . "project" . DIRECTORY_SEPARATOR . "modules";
$moduleFolders = Initializer::getDirectory($modulePath, TRUE);
foreach ($moduleFolders as $i => $mfolder) {
$fd = trim($mfolder);
$rp = trim($modulePath) . DIRECTORY_SEPARATOR;
$f = "modules" . DIRECTORY_SEPARATOR . str_replace($rp, "", $fd);
set_include_path(get_include_path() . PATH_SEPARATOR . $f);
}
/**
* include folders under project, library, plug-in
*
*/
$plugIn = $root . DIRECTORY_SEPARATOR . "plugin";
$coreLib = $root . DIRECTORY_SEPARATOR . "app" . DIRECTORY_SEPARATOR . "library";
$project = $root . DIRECTORY_SEPARATOR . "project";
$plugInFolders = Initializer::getDirectory($plugIn, TRUE);
foreach ($plugInFolders as $i => $folder1) {
$fd = trim($folder1);
$rp = trim($plugIn) . DIRECTORY_SEPARATOR;
$f = "plugin" . DIRECTORY_SEPARATOR . str_replace($rp, "", $fd);
set_include_path(get_include_path() . PATH_SEPARATOR . $f);
}
$coreLibFolders = Initializer::getDirectory($coreLib, TRUE);
foreach ($coreLibFolders as $i => $folder1) {
$fd = trim($folder1);
$rp = trim($coreLib) . DIRECTORY_SEPARATOR;
$f = "app" . DIRECTORY_SEPARATOR . "library" . DIRECTORY_SEPARATOR . str_replace($rp, "", $fd);
set_include_path(get_include_path() . PATH_SEPARATOR . $f);
}
$projectFolders = Initializer::getDirectory($project, TRUE);
foreach ($projectFolders as $i => $folder1) {
$fd = trim($folder1);
$rp = trim($project) . DIRECTORY_SEPARATOR;
$f = "project" . DIRECTORY_SEPARATOR . str_replace($rp, "", $fd);
set_include_path(get_include_path() . PATH_SEPARATOR . $f);
}
if (file_exists($configFile)) {
FileCache::save(self::FILECACHE, get_include_path());
}
}