Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
TCacheNode = class(TAvlTreeNode) private FKey : String; FData: Pointer; FLen : Integer; FIdxRef : TCacheIdxNode; public constructor Create(Key: String; Data: Pointer; Len: Integer); destructor Destroy; override; prope

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Arno Garrels
Arno Garrels wrote: > Fastream Technologies wrote: >> FYI, this is the code: >> >> RAMFileCacheIndex->OnList = CacheTreeOnListForRAM; >> RAMFileCacheIndex->ListTree(); >> >> for(int i = RAMFileCacheIndexList->Count - 1; i >= 0; --i) >> >> deleteFileFromRAMCacheWRTIndex((RAMFileCache*)RAMFileC

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Arno Garrels
Fastream Technologies 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], > fa

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Arno Garrels
Fastream Technologies wrote: > Ok, let's go step by step: How do I get the TCacheNode of the last > inserted one? Not possible, you only can get the oldest, why do you need that? I could easily add property Latest which should be the Last in the secondary tree with the TimeStamps. It is not possi

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
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(bufferFileCach

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
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 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, 20

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
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 wrote: > FYI, this is the code: > > RAMFileCacheIndex->OnList = CacheTreeOnListForRAM; > RAMFileCacheIndex->ListTree(); > > for(int i = R

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
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 RAMFi

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
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: ga...@fastream.com. Best Regards, SZ On Mon, Dec 5, 2011 at 13:47, Arno Garrels wrot

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Arno Garrels
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/URL

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
Ok but how will I update an existing duplicarte record so that it becomes Last()?? Best Regards, SZ On Mon, Dec 5, 2011 at 13:11, Arno Garrels wrote: > Fastream Technologies wrote: > > On Sun, Dec 4, 2011 at 11:05, Arno Garrels > > wrote: > > > >> - Original Message - > >> From: "Fastre

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Arno Garrels
Fastream Technologies wrote: > On Sun, Dec 4, 2011 at 11:05, Arno Garrels > wrote: > >> - Original Message - >> From: "Fastream Technologies" >> To: "ICS support mailing" >> Sent: Sunday, December 04, 2011 7:16 AM >> Subject: Re: [twsocket] Converting a cache to AVL tree >> >> >>> Th

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
Let me elaborate the issue: In our caches, we may have duplicate URLs. How would one update a timestamp with tcachenode pointer? Best Regards, SZ On Mon, Dec 5, 2011 at 12:47, Fastream Technologies wrote: > On Sun, Dec 4, 2011 at 11:05, Arno Garrels wrote: > >> - Original Message - >> Fr

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
On Sun, Dec 4, 2011 at 11:05, Arno Garrels wrote: > - Original Message - > From: "Fastream Technologies" > To: "ICS support mailing" > Sent: Sunday, December 04, 2011 7:16 AM > Subject: Re: [twsocket] Converting a cache to AVL tree > > > > The component I tried to use is TCacheTree. It