Atl Server - CBlobCache
-
I'm having difficulty using ATL Server's CBlobCache class. I'm trying to add an entry to the blob cache. The key is "v1" and the value is an int. The add method takes a *void for the actual data, so I figured I could push an int into it. Unfortunately, the mout int reads 6,500,000 . Is it a problem with my implementation of m_spBlobCache->Add or m_spBlobCache->GetData ? HCACHEITEM hEntry; // Get the IMemoryCache service from the ISAPI extension if (FAILED(m_spServiceProvider->QueryService(__uuidof(IMemoryCache), &m_spBlobCache))) return HTTP_FAIL; HRESULT hr = m_spBlobCache->LookupEntry("v1", &hEntry); if (FAILED(hr) || !hEntry) { static const int s7 = 1; int *pData = (int *)malloc(sizeof(int)); if (!pData) return HTTP_FAIL; *pData = s7; CFileTime ft = CFileTime::GetCurrentTime() + CFileTime::Minute; if(FAILED(m_spBlobCache->Add("v1", pData, (DWORD)sizeof(int), &ft, m_hInstHandler, &hEntry, &g_MemoryCacheClient))) { m_spBlobCache->ReleaseEntry(hEntry); return HTTP_FAIL; } } if(FAILED(m_spBlobCache->GetData(hEntry, (void**)&mout, &dwSize))) { m_spBlobCache->ReleaseEntry(hEntry); return HTTP_FAIL; } TIA Ryan
-
I'm having difficulty using ATL Server's CBlobCache class. I'm trying to add an entry to the blob cache. The key is "v1" and the value is an int. The add method takes a *void for the actual data, so I figured I could push an int into it. Unfortunately, the mout int reads 6,500,000 . Is it a problem with my implementation of m_spBlobCache->Add or m_spBlobCache->GetData ? HCACHEITEM hEntry; // Get the IMemoryCache service from the ISAPI extension if (FAILED(m_spServiceProvider->QueryService(__uuidof(IMemoryCache), &m_spBlobCache))) return HTTP_FAIL; HRESULT hr = m_spBlobCache->LookupEntry("v1", &hEntry); if (FAILED(hr) || !hEntry) { static const int s7 = 1; int *pData = (int *)malloc(sizeof(int)); if (!pData) return HTTP_FAIL; *pData = s7; CFileTime ft = CFileTime::GetCurrentTime() + CFileTime::Minute; if(FAILED(m_spBlobCache->Add("v1", pData, (DWORD)sizeof(int), &ft, m_hInstHandler, &hEntry, &g_MemoryCacheClient))) { m_spBlobCache->ReleaseEntry(hEntry); return HTTP_FAIL; } } if(FAILED(m_spBlobCache->GetData(hEntry, (void**)&mout, &dwSize))) { m_spBlobCache->ReleaseEntry(hEntry); return HTTP_FAIL; } TIA Ryan