![]() | CCacheEntry<T>::GetValue |
Retrieves the value of a cache entry.
bool CCacheEntry<T>::GetValue(T* pValue) const;
[out] Cached value. If the value is not valid, then the value of this parameter is undefined.
Returns true if the value is in the cache and is valid, otherwise false.
The following example demonstrates use of the GetValue function.
// CoAcme4321.cpp STDMETHODIMP Acme4321::get_Bandwidth(double* val) { HRESULT hr = S_OK; // Retrieve the cache entry for the Bandwidth property CCacheEntry<double>* pEntry = GetOrCreateCacheEntry<double>(_T("IAcme4321.Bandwidth")); // If the value is in the cache AND is valid, retrieve the value and return if (pEntry->GetValue(val)) return S_OK; // If we get this far, then the cached value is not valid, so we // must communicate with the instrument to retrieve the value hr = InstrQueryCommand(val); return hr; }