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 arno.garr...@gmx.de wrote: Fastream Technologies wrote: FLastInsertedNode :=

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 TWSocket

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 arno.garr...@gmx.de wrote: Fastream Technologies wrote: It seems to

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
- Original Message - From: Fastream Technologies ga...@fastream.com To: ICS support mailing twsocket@elists.org 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

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

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
On Sun, Dec 4, 2011 at 11:05, Arno Garrels arno.garr...@gmx.de wrote: - Original Message - From: Fastream Technologies ga...@fastream.com To: ICS support mailing twsocket@elists.org 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-05 Thread Fastream Technologies
: - Original Message - From: Fastream Technologies ga...@fastream.com To: ICS support mailing twsocket@elists.org 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

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Arno Garrels
] 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 will use my own code for it. TCacheTree doesn't use any timer

Re: [twsocket] Converting a cache to AVL tree

2011-12-05 Thread Fastream Technologies
Message - From: Fastream Technologies ga...@fastream.com To: ICS support mailing twsocket@elists.org 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 added

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

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

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

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 ga...@fastream.comwrote: FYI, this is the code: RAMFileCacheIndex-OnList = CacheTreeOnListForRAM; RAMFileCacheIndex-ListTree();

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

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

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], false);

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)

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;

Re: [twsocket] Converting a cache to AVL tree

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

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Arno Garrels
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 will use my own code for it. TCacheTree

Re: [twsocket] Converting a cache to AVL tree

2011-12-04 Thread Fastream Technologies
, Dec 4, 2011 at 11:05, Arno Garrels arno.garr...@gmx.de wrote: - Original Message - From: Fastream Technologies ga...@fastream.com To: ICS support mailing twsocket@elists.org 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 Fastream Technologies
On Sun, Dec 4, 2011 at 11:40, Arno Garrels arno.garr...@gmx.de 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

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 ga...@fastream.comwrote: On Sun, Dec 4, 2011 at 11:40, Arno Garrels arno.garr...@gmx.de wrote:

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 ga...@fastream.comwrote: 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

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 Arno Garrels
Fastream Technologies wrote: On Sun, Dec 4, 2011 at 11:40, Arno Garrels arno.garr...@gmx.de 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

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

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

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 ga...@fastream.comwrote: 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

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:

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

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

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