TCacheNode = class(TAvlTreeNode)
    private
        FKey     : String;
        FData    : Pointer;
        FLen     : Integer;
        FIdxRef  : TCacheIdxNode;
    public
        constructor Create(Key: String; Data: Pointer; Len: Integer);
        destructor  Destroy; override;
        property    Key: String read FKey;
        property    Data: Pointer read FData write FData; // could you add
this "write FData"?? Fastream
        property    Len: Integer read FLen;
        property    IdxRef: TCacheIdxNode read FIdxRef;
    end;
Best Regards,

SZ
On Mon, Dec 5, 2011 at 18:05, Arno Garrels <arno.garr...@gmx.de> wrote:

> 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*)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);
> >> }
> >>
> //---------------------------------------------------------------------------
> >
> > If you do not override DoListNode you have to use a TStringList in
> > CacheTreeOnListForRAM and add the key.
> > After ListTree() call RemoveKey() on each list item, and of course
> > you should have OnFreeData assigned and free your Data there, be it
> > objects or other pointers to allocated memory.
>
> And if you choose to free Data explicitly somewhere else you should
> set Data to NULL/nil because otherwise you might attempt to free it a
> second time from OnFreeData, if Data is NULL OnFreeData won't be
> triggered for a node.
>
> --
> Arno Garrels
>
>
> >
> > --
> > 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

Reply via email to