[yunqa.de] Re: TDIHash and LRU (least recently used) management

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 11 Feb 2009 18:42:57 +0100

Gerald wrote:

>I'm wondering if TDIHash supports LRU (least recently used) management
>like TStHashTable from the SysTools-Package to make it possible to
>throw out the oldest elements when a specified capacity is exceeded.

LRU (last recently used) items are not managed by TDIHash. Frankly speaking, 
this "feature" never crossed my mind when developing DIContainers because it 
adds unnecessary overhead to memory usage and insertion times.

>Any idea how to implement that?

Use the mentioned SysTools library or a linked list in parallel to the hash 
container. Linked list have minimal, constant insertion and removal times.

You can add a link pointer as part of the item itself to minimize memory usage 
and list overhead like item counting, etc.

Ralf 

_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: