Hi again,
I think the problem is in the delete routine:
bool __fastcall ProxyCache::deleteFileFromRAMCacheWRTIndex(RAMFileCache
*bufferFileCache, bool alreadyMarkedAsToDelete)
{
if(!bufferFileCache)
return false;
if(bufferFileCache->cacheTreeNode)
{
RAMFileCacheIndex->Remove(bufferFileCache->cacheTreeNode);
bufferFileCache->cacheTreeNode = NULL;
}
cacheCurrentRAMSize -= bufferFileCache->getAndZeroSize(); // first time it
subtracts and then returns 0
if(!bufferFileCache->getWriteLock() && !bufferFileCache->getIsReadLock())
{
delete bufferFileCache;
return true;
}
else
{
if(!alreadyMarkedAsToDelete)
bufferFileCache->setDeleteFileASAP();
return false;
}
}
//--------------------------------------------------------------------------
if(bufferFileCache->cacheTreeNode)
{
RAMFileCacheIndex->Remove(bufferFileCache->cacheTreeNode);
bufferFileCache->cacheTreeNode = NULL;
}
When this is entered, the data pointer or the bufferfilecache is NOT
deleted by the tree, right? Also my question is pending, how do I get the
tcachenode of the lastly inserted/updated data??
Best Regards,
SZ
On Mon, Dec 5, 2011 at 17:08, Fastream Technologies <[email protected]>wrote:
> Both of these do not work. Must I pass Now() while updating? I am just
> passing the old timestamp!
> Regards,
>
> SZ
> On Mon, Dec 5, 2011 at 16:51, Fastream Technologies <[email protected]>wrote:
>
>> Ok, let's go step by step: How do I get the TCacheNode of the last
>> inserted one? First() or Last()?
>> SZ
>> On Mon, Dec 5, 2011 at 16:38, Fastream Technologies
>> <[email protected]>wrote:
>>
>>> FYI, this is the code:
>>>
>>> RAMFileCacheIndex->OnList = CacheTreeOnListForRAM;
>>> RAMFileCacheIndex->ListTree();
>>>
>>> for(int i = RAMFileCacheIndexList->Count - 1; i >= 0; --i)
>>>
>>> deleteFileFromRAMCacheWRTIndex((RAMFileCache*)RAMFileCacheIndexList->Items[i],
>>> false); (basically deletes the data
>>>
>>> RAMFileCacheIndexList->Clear();
>>> ...
>>>
>>> void __fastcall ProxyCache::CacheTreeOnListForRAM(TObject *Sender, const
>>> String Key, TDateTime TimeStamp, Pointer Data, int Len, TDateTime Expires,
>>> bool &Cancel)
>>> {
>>> RAMFileCacheIndexList->Add(Data);
>>> }
>>>
>>> //---------------------------------------------------------------------------
>>>
>>> Best Regards,
>>>
>>> SZ
>>> On Mon, Dec 5, 2011 at 16:36, Fastream Technologies <[email protected]
>>> > wrote:
>>>
>>>> Okay, let's do it one entry per URL. Now the TList recording and
>>>> deleting afterwards in OnList does NOT work. Gives AV. What is the proper
>>>> way? Can you help us with some consultancy? Please let me know privately:
>>>> [email protected].
>>>> Best Regards,
>>>>
>>>> SZ
>>>>
>>>> On Mon, Dec 5, 2011 at 13:47, Arno Garrels <[email protected]> wrote:
>>>>
>>>>> Fastream Technologies wrote:
>>>>> > Let me elaborate the issue: In our caches, we may have duplicate
>>>>> > URLs.
>>>>>
>>>>> Then TCacheTree doesn't fit.
>>>>> As I wrote yesterday, the Key (in your case the URL) must be unique,
>>>>> no way around, it is the primary key.
>>>>> However there may exist multiple, different Keys/URLs with the same
>>>>> TimeStamp since it is easily possible to add thousands of items
>>>>> in less than 10 ms with Now() always returning the same value.
>>>>>
>>>>> --
>>>>> Arno Garrels
>>>>> --
>>>>> To unsubscribe or change your settings for TWSocket mailing list
>>>>> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
>>>>> Visit our website at http://www.overbyte.be
>>>>>
>>>>
>>>>
>>>
>>
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be