XLL+ Class Library (6.3)

CXlOperCache::Save

Save the contents of the cache to a file

bool Save(
   const CString& fileName
) const;

Parameters

fileName

The full path of a file. The file will be completely overwritten.

Return Value

The fuction returns true if the operation was successful, or false it fails for any reason.

Remarks

This method is implemented inline in xlserialize.h so that it can easily be used as the basis for your own more sophisiticated implementations, such as a shared cache.

Example

You can save the cache to disk when the XLL closes and restore it each time the XLL is opened.

You should implement the OnXllOpenEx() and OnXllClose() overrideable methods of the application class, to restore and save the cache.

The code below shows how to do this:

CopyC++
CAvgOptApp : public CXllApp {
    ...
    CString m_strCacheFile;
    ...
};

BOOL CAvgOptApp::OnXllOpenEx()
{
    // Restore cache 
    if (CXlOperCache::GetUserCacheFilePath(m_strCacheFile))
        m_cache.Restore(m_strCacheFile);

    return TRUE;
}

void CAvgOptApp::OnXllClose()
{
    m_cache.Save(m_strCacheFile);
}

Requirements

Header: xlserialize.h

See Also

CXlOperCache Class | CXlOperCache Methods