Ejemplo n.º 1
0
gbool GUrlCache::NeedCacheCleaning(DWORD theTime)
{
    // too much space used ?

    if ( (spaceUsed+bytesWrittenToCache) >maxSpaceUsed)
        needCacheCleaning=TRUE;
    else if (spaceUsed <= 0) { // we don't know yet, written more then 5 % , was 2 % ?
        if ( (bytesWrittenToCache >= (maxSpaceUsed/20)) /* && (bytesWrittenToCache> (200*1024)) */ )
            needCacheCleaning = TRUE;
    }

    if (needCacheCleaning) return TRUE;

    if (((long)theTime-(long)lastDiskSpaceCheck) > 1000l*120l) { // two minutes
        // monitor free disk space
        LONGLONG diskSpace = GetFreeDiskSpace();

        if (minSpaceFree>0 && (diskSpace < minSpaceFree)) {
            needCacheCleaning=TRUE;
        }
        lastDiskSpaceCheck = theTime;
        TRACE("Diskspace free = %ld KB \n", (long) (diskSpace / 1024));
    }
    return needCacheCleaning;

}
Ejemplo n.º 2
0
DirectoriesPrefs::DirectoriesPrefs(wxWindow * parent):
    PrefsPanel(parent)
{
    mTempDir = gPrefs->Read("/Directories/TempDir", "");
    mOldTempDir = mTempDir;

    topSizer = new wxBoxSizer( wxVERTICAL );

    wxStaticBoxSizer *tempDirSizer = new wxStaticBoxSizer(
        new wxStaticBox(this, -1, _("Temp. Directory")), wxVERTICAL );

    wxFlexGridSizer *tempDirGridSizer = new wxFlexGridSizer( 0, 3, 0, 0 );

    mTempDirLabel = new wxStaticText(
        this, -1, _("Location:"), wxDefaultPosition,
        wxDefaultSize, wxALIGN_RIGHT );

    /* Order is important here: mFreeSpace must be allocated before
       mTempDirText, so that the handler doesn't try to operate on
       mFreeSpace before it exists! */
    mFreeSpace = new wxStaticText(
        this, -1, FormatSize(GetFreeDiskSpace((char *) (const char *) mTempDir)),
        wxDefaultPosition, wxDefaultSize, 0 );

    mTempDirText = NULL;
    mTempDirText = new wxTextCtrl(
        this, TempDirID, mTempDir,
        wxDefaultPosition, wxSize(160, -1), 0 );

    mFreeSpaceLabel = new wxStaticText(
        this, -1, _("Free Space:"),
        wxDefaultPosition, wxDefaultSize, 0 );

    wxButton *chooseButton =
        new wxButton(this, ChooseButtonID, _("Choose..."));

    tempDirGridSizer->Add( mTempDirLabel, 0, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 2 );
    tempDirGridSizer->Add( mTempDirText, 1, wxGROW|wxALL|wxALIGN_CENTER_VERTICAL, 2 );
    tempDirGridSizer->Add( chooseButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 2 );

    tempDirGridSizer->Add( mFreeSpaceLabel, 0, wxALIGN_LEFT|wxALL|wxALIGN_CENTER_VERTICAL, 2 );
    tempDirGridSizer->Add( mFreeSpace, 0, wxGROW|wxALL|wxALIGN_CENTER_VERTICAL, 2 );
    tempDirGridSizer->AddGrowableCol(1);
    tempDirSizer->Add( tempDirGridSizer, 0, wxGROW|wxALL, 2 );

    topSizer->Add( tempDirSizer, 0, wxGROW|wxALL, 5 );

    outSizer = new wxBoxSizer( wxVERTICAL );
    outSizer->Add(topSizer, 0, wxGROW|wxALL, TOP_LEVEL_BORDER);

    SetAutoLayout(true);
    SetSizer(outSizer);

    outSizer->Fit(this);
    outSizer->SetSizeHints(this);
}
Ejemplo n.º 3
0
void DirectoriesPrefs::UpdateFreeSpace(wxCommandEvent &event)
{
   static wxLongLong space;
   static wxString tempDir;
   static char tmp[200];

   tempDir = event.GetString();

#ifndef __WXMAC__  // the mac GetFreeDiskSpace routine does this automatically
   /* Try to be smart: if the directory doesn't exist, go up the
    * directory path until one is, because that's the volume that
    * the new directory would be created on */
   while(!wxDirExists(tempDir) && tempDir.Find(wxFILE_SEP_PATH) != -1)
      tempDir = tempDir.BeforeLast(wxFILE_SEP_PATH);
#endif
   strncpy(tmp, tempDir.c_str(), 200);
   space = GetFreeDiskSpace(tmp);
   
   mFreeSpace->SetLabel(FormatSize(space));
}
Ejemplo n.º 4
0
CString CBot::SysInfo()
{	CString sSysInfo;
#ifdef WIN32
	int total=GetTickCount()/1000;
	MEMORYSTATUS memstat; OSVERSIONINFO verinfo;
	char szBuffer[MAX_COMPUTERNAME_LENGTH + 1];
	DWORD dwNameSize = MAX_COMPUTERNAME_LENGTH + 1;
	char *szCompname;
	TCHAR szUserName[21];
	DWORD dwUserSize = sizeof(szUserName);

	GlobalMemoryStatus(&memstat); verinfo.dwOSVersionInfoSize=sizeof(OSVERSIONINFO); GetVersionEx(&verinfo); char *os; char os2[140];
	if(verinfo.dwMajorVersion==4 && verinfo.dwMinorVersion==0)
	{	if(verinfo.dwPlatformId==VER_PLATFORM_WIN32_WINDOWS)			os="95";
		if(verinfo.dwPlatformId==VER_PLATFORM_WIN32_NT)					os="NT"; }
	else if(verinfo.dwMajorVersion==4 && verinfo.dwMinorVersion==10)	os="98";
	else if(verinfo.dwMajorVersion==4 && verinfo.dwMinorVersion==90)	os="ME";
	else if(verinfo.dwMajorVersion==5 && verinfo.dwMinorVersion==0)		os="2000";
	else if(verinfo.dwMajorVersion==5 && verinfo.dwMinorVersion==1)		os="XP";
	else if(verinfo.dwMajorVersion==5 && verinfo.dwMinorVersion==2)		os="2003";
	else																os="???";

	if(verinfo.dwPlatformId==VER_PLATFORM_WIN32_NT && verinfo.szCSDVersion[0]!='\0')
	{	sprintf(os2, "%s [%s]", os, verinfo.szCSDVersion); os=os2; }
	GetComputerName(szBuffer, &dwNameSize);
	szCompname = szBuffer;
	GetUserName(szUserName, &dwUserSize);

	// *** PhaTTy <MOD> Changed ram: to ##MB/##MB , added box: , added user: </MOD>

	sSysInfo.Format("cpu: %dMHz ram: %dMB/%dMB os: %s (%d.%d, build %d) uptime: %dd %dh %dm box: %s user: %s freespace: %s",
	cpuspeed(), memstat.dwAvailPhys/1046528, memstat.dwTotalPhys/1046528, os, verinfo.dwMajorVersion, verinfo.dwMinorVersion, verinfo.dwBuildNumber, total/86400, (total%86400)/3600, ((total%86400)%3600)/60, szCompname, szUserName , GetFreeDiskSpace().CStr());


#else
	FILE *fp=fopen("/proc/uptime", "r");
	float f1, f2;
	
	if(!fp) return CString("Error: Can't open /proc/uptime!");

	if(fscanf(fp, "%f %f", &f1, &f2)<2) return CString("Error: Invalid or changed /proc/uptime format!");

	fclose(fp);
	
	int days, hours, minutes;
	days=((abs((int)f1)/60)/60)/24;
	hours=((abs((int)f1)/60)/60)%24;
	minutes=(abs((int)f1)/60)%60;

	int iDistro=GetDistro(); char *szVersion; char *szKVersion;
	bool bGotVer=GetVersion(&szVersion, iDistro);
	bool bGotKVer=GetKVersion(&szKVersion, iDistro);
	
	if(!bGotVer) szVersion="Unknown\n"; if(!bGotKVer) szKVersion="Unknown\n";
	
	sSysInfo.Format("cpu: %dMHz. os: %s. kernel: %s. uptime: %dd %dh %dm", cpuspeed(), szVersion, szKVersion, days, hours, minutes);

	if(bGotVer) free(szVersion); if(bGotKVer) free(szKVersion);
#endif
	return sSysInfo; }
Ejemplo n.º 5
0
DirManager::DirManager()
{
   if (firstCtor) {
      // The first time a DirManager is created, we need to find
      // a temp directory location.

      firstCtor = false;

      wxString tempFromPrefs = gPrefs->Read("/Directories/TempDir", "");
      wxString tempDefaultLoc = temp;

      temp = "";

      #ifdef __WXGTK__         
      if (tempFromPrefs.GetChar(0) != '/')
         tempFromPrefs = "";
      #endif

      // Stop wxWindows from printing its own error messages

      wxLogNull logNo;

      // Try temp dir that was stored in prefs first

      if (tempFromPrefs != "") {
         if (wxPathExists(tempFromPrefs))
            temp = tempFromPrefs;
         else if (wxMkdir(tempFromPrefs))
            temp = tempFromPrefs;
      }

      // If that didn't work, try the default location

      if (temp=="" && tempDefaultLoc != "") {
         if (wxPathExists(tempDefaultLoc))
            temp = tempDefaultLoc;
         else if (wxMkdir(tempDefaultLoc))
            temp = tempDefaultLoc;
      }

      if (temp != "") {
         // Success
         gPrefs->Write("/Directories/TempDir", temp);
      }
      else {
         wxMessageBox("Audacity could not find a place to store temporary files.\n"
                      "Please enter an appropriate directory in the "
                      "preferences dialog.");

         PrefsDialog dialog(NULL);
         dialog.ShowModal();

         wxMessageBox("Audacity is now going to exit.  Please launch Audacity "
                      "again to use the new temporary directory.");
         wxExit();
      }

   }
   numDirManagers++;
   if (numDirManagers == 1) {
      CleanTempDir();
   }

   projPath = "";
   projName = "";

   hashTableSize = defaultHashTableSize;
   blockFileHash = new wxHashTable(wxKEY_STRING, hashTableSize);

   // Make sure there is plenty of space for temp files

   wxLongLong freeSpace = GetFreeDiskSpace((char *) (const char *) temp);
   if (freeSpace >= 0) {
      if (freeSpace < 1048576) {
         // TODO: allow user to select different temporary volume.
         wxMessageBox
             ("Warning: there is very little free disk space left on this volume. Please select another temporary directory in your preferences.");
      }
   }
}
/////////////////////////////////////////////////////////////////////
// 
// Function:    
//
// Description: 
//
/////////////////////////////////////////////////////////////////////
UINT CAMigrateBOINCData::OnExecution()
{
    tstring      strCustomActionData;
    tstring      strCurrentInstallDirectory;
    tstring      strFutureInstallDirectory;
    tstring      strCurrentDataDirectory;
    tstring      strFutureDataDirectory;
    tstring      strMigration;
    tstring      strMigrationVersion;
    tstring      strMigrationDirectory;
    tstring      strDestinationClientStateFile;
    tstring      strRemove;
    tstring      strProductVersion;
    tstring      strWindowsDirectory;
    tstring      strWindowsSystemDirectory;
    tstring      strProgramFilesDirectory;
    tstring      strSystemDrive;
    tstring      strVersionWindows64;
    struct _stat buf;
    ULONGLONG    ullFileSize = 0;
    ULONGLONG    ullDirectorySize = 0;
    ULONGLONG    ullFreeDiskSpace = 0;
    UINT         uiReturnValue = -1;

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        _T("CAMigrateBOINCData::OnExecution -- Function Begin")
    );


    GetRegistryValue( _T("INSTALLDIR"), strCurrentInstallDirectory );

    uiReturnValue = GetProperty( _T("INSTALLDIR"), strFutureInstallDirectory );
    if ( uiReturnValue ) return uiReturnValue;

    uiReturnValue = GetProperty( _T("DATADIR"), strFutureDataDirectory );
    if ( uiReturnValue ) return uiReturnValue;

    uiReturnValue = GetRegistryValue( _T("MIGRATION"), strMigration );
    uiReturnValue = GetRegistryValue( _T("MIGRATIONVERSION"), strMigrationVersion );
    uiReturnValue = GetRegistryValue( _T("MIGRATIONDIR"), strMigrationDirectory );

    uiReturnValue = GetProperty( _T("REMOVE"), strRemove );
    if ( uiReturnValue ) return uiReturnValue;

    uiReturnValue = GetProperty( _T("ProductVersion"), strProductVersion );
    if ( uiReturnValue ) return uiReturnValue;

    uiReturnValue = GetProperty( _T("VersionNT64"), strVersionWindows64 );
    if ( uiReturnValue ) return uiReturnValue;

    uiReturnValue = GetProperty( _T("WindowsFolder"), strWindowsDirectory );
    if ( uiReturnValue ) return uiReturnValue;

    uiReturnValue = GetProperty( _T("WindowsVolume"), strSystemDrive );
    if ( uiReturnValue ) return uiReturnValue;

    if (strVersionWindows64.length() > 0)
    {
        uiReturnValue = GetProperty( _T("System64Folder"), strWindowsSystemDirectory );
        if ( uiReturnValue ) return uiReturnValue;

        uiReturnValue = GetProperty( _T("ProgramFiles64Folder"), strProgramFilesDirectory );
        if ( uiReturnValue ) return uiReturnValue;
    }
    else
    {
        uiReturnValue = GetProperty( _T("SystemFolder"), strWindowsSystemDirectory );
        if ( uiReturnValue ) return uiReturnValue;

        uiReturnValue = GetProperty( _T("ProgramFilesFolder"), strProgramFilesDirectory );
        if ( uiReturnValue ) return uiReturnValue;
    }


    // If the REMOVE property is specified, then we are uninstalling BOINC
    if (strRemove.length())
    {
        // If we successfully migrated, and the user is now uninstalling, they
        //   are probably going back to a 6.x client, so don't migrate the
        //   data back to the 5.x location.
        //
        strMigration = _T("FALSE");
        strCustomActionData += strMigration + _T("|");
        strCustomActionData += strMigrationDirectory + _T("|");
        strCustomActionData += strFutureDataDirectory;
    }
    else
    {
        strDestinationClientStateFile = strFutureDataDirectory + _T("\\client_state.xml");

        // Perform some basic sanity tests to see if we need to migrate
        //   anything.
        BOOL bClientStateExists =
            (BOOL)(0 == _stat(strDestinationClientStateFile.c_str(), &buf));
        BOOL bInstallDataSameDirectory = 
            (BOOL)(strFutureInstallDirectory == strFutureDataDirectory);
        BOOL bDataDirExistsWithinInstallDir = 
            (BOOL)(tstring::npos != strFutureDataDirectory.find(strFutureInstallDirectory));
        BOOL bInstallDirWindowsDirSame = 
            (BOOL)(strFutureInstallDirectory == strWindowsDirectory);
        BOOL bDataDirWindowsDirSame = 
            (BOOL)(strFutureDataDirectory == strWindowsDirectory);
        BOOL bInstallDirSystemDriveSame = 
            (BOOL)(strFutureInstallDirectory == strSystemDrive);
        BOOL bDataDirSystemDriveSame = 
            (BOOL)(strFutureDataDirectory == strSystemDrive);
        BOOL bInstallDirWindowsSystemDirSame = 
            (BOOL)(strFutureInstallDirectory == strWindowsSystemDirectory);
        BOOL bDataDirWindowsSystemDirSame = 
            (BOOL)(strFutureDataDirectory == strWindowsSystemDirectory);
        BOOL bInstallDirProgramFilesDirSame = 
            (BOOL)(strFutureInstallDirectory == strProgramFilesDirectory);
        BOOL bDataDirProgramFilesDirSame = 
            (BOOL)(strFutureDataDirectory == strProgramFilesDirectory);

        if      ( bClientStateExists )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data files already exists, skipping migration.")
            );
        }
        else if ( bInstallDataSameDirectory ) 
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Install directory and data directory are the same, skipping migration.")
            );
        }
        else if ( bDataDirExistsWithinInstallDir )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data drectory exists within the install directory, skipping migration.")
            );
        }
        else if ( bInstallDirWindowsDirSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Install directory is the same as the Windows directory, skipping migration.")
            );
        }
        else if ( bDataDirWindowsDirSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data directory is the same as the Windows directory, skipping migration.")
            );
        }
        else if ( bInstallDirSystemDriveSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Install directory is the same as the system drive, skipping migration.")
            );
        }
        else if ( bDataDirSystemDriveSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data directory is the same as the system drive, skipping migration.")
            );
        }
        else if ( bInstallDirWindowsSystemDirSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Install directory is the same as the Windows system directory, skipping migration.")
            );
        }
        else if ( bDataDirWindowsSystemDirSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data directory is the same as the Windows system directory, skipping migration.")
            );
        }
        else if ( bInstallDirProgramFilesDirSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Install directory is the same as the program files directory, skipping migration.")
            );
        }
        else if ( bDataDirProgramFilesDirSame )
        {
            strMigration = _T("FALSE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data directory is the same as the program files directory, skipping migration.")
            );
        }
        else
        {
            strMigration = _T("TRUE");
            LogMessage(
                INSTALLMESSAGE_INFO,
                NULL, 
                NULL,
                NULL,
                NULL,
                _T("Data files do NOT exist, performing migration.")
            );

            strMigrationDirectory = strCurrentInstallDirectory + _T("\\client_state.xml");
            if (0 == _stat(strMigrationDirectory.c_str(), &buf)) {
                strMigrationDirectory = strCurrentInstallDirectory;
            } else {
                strMigrationDirectory = strFutureInstallDirectory;
            }

            if ( GetFileDirectorySizes( strMigrationDirectory, ullFileSize, ullDirectorySize ) )
            {
                // The total amount of disk space required depends on whether or not
                //   the files in the original location are on the same volume as the
                //   destination. So do a quick check to see if we have enough disk
                //   space.
                if (!GetFreeDiskSpace(strFutureDataDirectory, ullFreeDiskSpace))
                {
                    // If the destination directory doesn't exist, try the parent
                    //   directory
                    tstring strBuffer = tstring(strFutureDataDirectory + _T("..\\"));
                    if (!GetFreeDiskSpace(strBuffer, ullFreeDiskSpace))
                    {
                        // If the parent directory doesn't exist, just choose
                        //   the default volume. Something is better than nothing
                        GetFreeDiskSpace(tstring(""), ullFreeDiskSpace);
                    }
                }


                // Are we on the same volume?
                if (strMigrationDirectory.substr(0, 2) == strFutureDataDirectory.substr(0, 2))
                {
                    // We only need the amount of free space as the largest file
                    //   that is going to be transfered.
                    if (ullFileSize > ullFreeDiskSpace)
                    {
                        LogMessage(
                            INSTALLMESSAGE_INFO,
                            NULL, 
                            NULL,
                            NULL,
                            NULL,
                            _T("Not enough free disk space is available to migrate BOINC's data files to\n"
                               "the new data directory. Please free up some disk space or migrate the files\n"
                               "manually. (ullFileSize > ullFreeDiskSpace)")
                        );
                        return ERROR_INSTALL_FAILURE;
                    }
                }
                else
                {
                    // We only need the amount of free space of the directory
                    //   that is going to be transfered.
                    if (ullDirectorySize > ullFreeDiskSpace)
                    {
                        LogMessage(
                            INSTALLMESSAGE_INFO,
                            NULL, 
                            NULL,
                            NULL,
                            NULL,
                            _T("Not enough free disk space is available to migrate BOINC's data files to\n"
                               "the new data directory. Please free up some disk space or migrate the files\n"
                               "manually. (ullDirectorySize > ullFreeDiskSpace)")
                        );
                        return ERROR_INSTALL_FAILURE;
                    }
                }
            }
        }

        // Contruct a '|' delimited string to pass along to the install script
        //   and rollback script parts of this custom action.
        strCustomActionData += strMigration + _T("|");
        strCustomActionData += strMigrationDirectory + _T("|");
        strCustomActionData += strFutureDataDirectory;
    }

    SetRegistryValue( _T("MIGRATION"), strMigration );
    SetRegistryValue( _T("MIGRATIONDIR"), strMigrationDirectory );
    SetProperty( _T("CAMigrateBOINCDataInstall"), strCustomActionData );
    SetProperty( _T("CAMigrateBOINCDataRollback"), strCustomActionData );

    LogMessage(
        INSTALLMESSAGE_INFO,
        NULL, 
        NULL,
        NULL,
        NULL,
        _T("CAMigrateBOINCData::OnExecution -- Function End")
    );

    return ERROR_SUCCESS;
}
Ejemplo n.º 7
0
// check the cache to clean up stuff
gbool GUrlCache::CheckCache()
{
    gbool ret=FALSE;


    int maxCnt=0;
    LONGLONG maxBytes=0;

    GFileSorter sorter;

    TRACE("Check cache start \n");

    if (!writeCacheDirValid) return FALSE;
    cleanerBusy=TRUE;

    Lock();

    while (1) {
        time_t maxFileTime = 0;
        sorter.AddFiles(writeCacheDir,maxFileTime,stop);


        spaceUsed = sorter.fileSum;
        // how much byptes should be freed
        LONGLONG diskSpace = GetFreeDiskSpace();

        if (maxSpaceUsed >0 && spaceUsed >maxSpaceUsed)
            maxBytes = spaceUsed-maxSpaceUsed;

        if (minSpaceFree>0 && (diskSpace < minSpaceFree)) {

            maxBytes=max(maxBytes, (minSpaceFree-diskSpace));

        }
        TRACE("Cache cleaner Space used by cache files : %d k, Free Diskspace %d k, space to clean : %dk \n",(long)(spaceUsed / 1024),(long)(diskSpace/1024),(long)(maxBytes / 1024));
        if (maxBytes >0) { // delete a bit more
            maxBytes += max(maxBytes/8, LONGLONG(maxSpaceUsed / 8) ) ; // 12.05 %
        }
        if (maxBytes <= (100*1024)) { // to few bytes to free exit
            spaceUsed = sorter.fileSum;
            bytesWrittenToCache = 0;

            sorter.Flush();
            break;
        }


        if (stop) break;

        sorter.SortTime();

        if (stop) break;
        TRACE("Cache cleaner trying to deleting: : %dk \n",long(maxBytes / 1024));



        ret = sorter.DeleteOldest(*this,maxCnt,maxBytes,stop);

        if (stop) break;

        spaceUsed = sorter.fileSum;
        bytesWrittenToCache = 0; // clear for next time

        TRACE("Cache cleaner Space used by cache files : %ld k \n",(long) (spaceUsed / 1024));

        sorter.Flush();

        break;
    }
    needCacheCleaning = FALSE;
    lastCacheFlushTime = ::time(NULL);

    Unlock();
    cleanerBusy=FALSE;
    TRACE("Check cache end \n");

    return ret;


}