开发者

LinkedHashMap in Perl

开发者 https://www.devze.com 2023-03-30 03:16 出处:网络
Is there some data structure in Perl like LinkedHashMapin java? Or something LRU data structure in Perl

Is there some data structure in Perl like LinkedHashMap in java?

Or something LRU data structure in Perl

Update:@TLP Basically I'd like to have Hashtable data structure but also I can keep the order of keys coming in, remove keys after I process the key in开发者_如何学Go the list.

Update:@ccheneson Tie::IxHash one seems not what i want, I would like to POP an oldest key, but tie::ixHash pop up the latest key, How I get the oldest key value pair in Tie::IxHash? I'd like to have a queue Structure (and Hash Structure as well, I'd like to find the key in the easiest way), new Key,value pair keeps coming in and I keep process oldest Key and remove the oldest key.

Update:@ FMc Tie::IxHash is What I need, Tie::IxHash->Shift() does a queue pop Tie::IxHash->Push() does queue push and it is hash structure and easy to find keys.

Thanks all.


Tie::IxHash seems to be what you are looking for.

Tie::IxHash - ordered associative arrays for Perl

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号