Re: [twsocket] Converting a cache to AVL tree

2011-12-07 Thread Fastream Technologies
Yes it is indeed faster! Hard to measure but in the old version, during deletion it used to take n/2 time. n is the number of files which could reach up to 100K! Best Regards, SZ On Wed, Dec 7, 2011 at 17:57, Arno Garrels wrote: > Fastream Technologies wrote: > > > It seems to work perfectly now

Re: [twsocket] Converting a cache to AVL tree

2011-12-07 Thread Arno Garrels
Fastream Technologies wrote: > It seems to work perfectly now with your advice! See: > www.iqproxyserver.comis being served with the beta version using ICS > TCacheTree. Performance increased? > Thanks a lot, You are welcome. -- Arno Garrels -- To unsubscribe or change your settings for TWSoc

Re: [twsocket] Converting a cache to AVL tree

2011-12-07 Thread Fastream Technologies
Hello Arno, It seems to work perfectly now with your advice! See: www.iqproxyserver.comis being served with the beta version using ICS TCacheTree. Thanks a lot, SZ On Tue, Dec 6, 2011 at 18:56, Arno Garrels wrote: > Fastream Technologies wrote: > > FLastInsertedNode := CacheNode; // Fastream >

Re: [twsocket] Converting a cache to AVL tree

2011-12-06 Thread Arno Garrels
Fastream Technologies wrote: > FLastInsertedNode := CacheNode; // Fastream Not a good idea since the reference may change or the node be removed. -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twso

Re: [twsocket] Converting a cache to AVL tree

2011-12-06 Thread Arno Garrels
- Original Message - From: "Fastream Technologies" To: "ICS support mailing" Sent: Tuesday, December 06, 2011 4:40 PM Subject: Re: [twsocket] Converting a cache to AVL tree >I still get occasional AVs in shut down. It is in cacheNode deletion. This > is th

Re: [twsocket] Converting a cache to AVL tree

2011-12-06 Thread Fastream Technologies
I still get occasional AVs in shut down. It is in cacheNode deletion. This is the code: bool __fastcall ProxyCache::deleteFileFromDiskCacheWRTIndex(DiskFileCache *bufferFileCache, bool alreadyMarkedAsToDelete) { if(!bufferFileCache) return false; if(bufferFileCache->cacheTreeNode) { bufferF

Re: [twsocket] Converting a cache to AVL tree

2011-12-06 Thread Fastream Technologies
Hi Arno, procedure TCacheTree.Insert( Key : String; Data : Pointer; Len : Integer; TimeStamp : TDateTime = MinDT; Expires : TDateTime = MinDT; UpdateTime: Boolean = True; UpdateData: Boolean = True); var CacheNode,

Re: [twsocket] Converting a cache to AVL tree

2011-12-06 Thread Arno Garrels
Fastream Technologies wrote: >TCacheNode = class(TAvlTreeNode) >private >FKey : String; >FData: Pointer; >FLen : Integer; >FIdxRef : TCacheIdxNode; >public >constructor Create(Key: String; Data: Pointer; Len: Integer); >destru

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
iginal 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 componen

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 >

Re: [twsocket] Converting a cache to AVL tree

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

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 > > > >

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Arno Garrels wrote: > Arno Garrels wrote: >> Fastream Technologies wrote: >>> How about us to make a list of pointers in onlist and then remove? >> >> Yes, I'd just override DoListNode, something like (untested): > > Wait! It has to be tested, might not work, building a StringList > with the keys

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Arno Garrels wrote: > Fastream Technologies wrote: >> How about us to make a list of pointers in onlist and then remove? > > Yes, I'd just override DoListNode, something like (untested): Wait! It has to be tested, might not work, building a StringList with the keys however will work. -- To unsub

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Fastream Technologies wrote: > How about us to make a list of pointers in onlist and then remove? Yes, I'd just override DoListNode, something like (untested): TMyCache = class(TCacheTree) private FDeleteList: TList; FCondition: string; protected procedure DoListNode(Node: TAvlT

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
How about us to make a list of pointers in onlist and then remove? Best Regards, SZ On Sun, Dec 4, 2011 at 15:24, Fastream Technologies wrote: > Arno, > > The deletions occur once in a day/week or so, when the end admin user > clicks a button in GUI. It is not a part of every second cache operati

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
Arno, The deletions occur once in a day/week or so, when the end admin user clicks a button in GUI. It is not a part of every second cache operation. What is the easiest/safest way to delete by iteration? a. Implement a new TCacheTree with IPv6 AVLPointerTree? b. A very slow workaround for the cu

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Fastream Technologies wrote: > Hello Arno, > Can one remove a node in onlist? No, it's not possible with this old class. The new TIcsAvlPointerTree in the IPv6 branch has an iterator and supports for - in loops as well as removing nodes while in a for - in loop. -- To unsubscribe or change

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Fastream Technologies wrote: > Ok but how do I delete with respect to a data->property?? One needs one linked tree for each search key, if you have to iterate over a tree in order to find something a list would likely be faster. But if can live with slow deletions maybe you can use TIcsAvlPointer

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
Ok but how do I delete with respect to a data->property?? We use regex and string comparison for this! If you can help me with it, I will appreciate. We can be sponsors for this feature. I think we can live with OnList way but really need to be able to delete with respect to data... Regards, SZ On

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Fastream Technologies wrote: > On Sun, Dec 4, 2011 at 11:40, Arno Garrels > wrote: > >> Traversing the tree is only possible with method ListTree >> and assigning an OnList event handler. >> > > Could you give an example to traversing for the firstly inserted n > elements? Not possible. Al

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
Hello Arno, Can one remove a node in onlist? Regards, SubZ On Sun, Dec 4, 2011 at 13:16, Arno Garrels wrote: > Fastream Technologies wrote: > > Do you mean the tree self-destructs nodes and I will be notified of > > it to delete? > > You are notified before the class removes and frees a node, i

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
Fastream Technologies wrote: > Do you mean the tree self-destructs nodes and I will be notified of > it to delete? You are notified before the class removes and frees a node, i.e method Remove() triggers event OnFreeData and afterwards frees the node. The class doesn't own Data but its nodes, so

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
Okay, I now see your point, it is not async yet recursive. Regards, SZ On Sun, Dec 4, 2011 at 12:52, Fastream Technologies wrote: > I do not understand why it is async to traverse a list of nodes in RAM! It > ruins the program flow very much. Any solution? > Regards, > > SZ > > On Sun, Dec 4, 201

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
I do not understand why it is async to traverse a list of nodes in RAM! It ruins the program flow very much. Any solution? Regards, SZ On Sun, Dec 4, 2011 at 12:36, Fastream Technologies wrote: > On Sun, Dec 4, 2011 at 11:40, Arno Garrels wrote: > >> Traversing the tree is only possible with m

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
On Sun, Dec 4, 2011 at 11:40, Arno Garrels wrote: > Traversing the tree is only possible with method ListTree > and assigning an OnList event handler. > Could you give an example to traversing for the firstly inserted n elements? Regards, SZ -- To unsubscribe or change your settings for TWSoc

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
gning an OnList event handler. > > -- > Arno Garrels > > > > > SZ > > On Sun, Dec 4, 2011 at 11:05, Arno Garrels > > wrote: > > > >> - Original Message - > >> From: "Fastream Technologies" > >> To: "ICS suppo

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
ee and assigning an OnList event handler. -- Arno Garrels > > SZ > On Sun, Dec 4, 2011 at 11:05, Arno Garrels > wrote: > >> - Original Message - >> From: "Fastream Technologies" >> To: "ICS support mailing" >> Sent: Sunday,

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
7:16 AM > Subject: Re: [twsocket] Converting a cache to AVL tree > > > > The component I tried to use is TCacheTree. It has a timeout argument for > > each added item. I do not want any timers or any timeouts yet liked the > > component. Is there a way to omit expiration. I wi

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
- 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 has a timeout argument for > each add

Re: [twsocket] Converting a cache to AVL tree

2011-12-03 Thread Fastream Technologies
The component I tried to use is TCacheTree. It has a timeout argument for each added item. I do not want any timers or any timeouts yet liked the component. Is there a way to omit expiration. I will use my own code for it. Best Regards, SZ On Sat, Dec 3, 2011 at 18:54, Arno Garrels wrote: > Fast

Re: [twsocket] Converting a cache to AVL tree

2011-12-03 Thread Arno Garrels
Fastream Technologies wrote: > Hello, > > I wonder if there is an easy way to do this? How does one achieve no > timeout in ICS avl tree? Please be more specific, AFAIR there's no timeout in any ICS AVL tree. BTW: Also have a look at the new TIcsAvlPointerTree and TIcsAvlObjectTree in the IPv6 br