I like to announce a tiny utility I did for my last project. It is only a
single class that basically works like LRUCache internally but on the outside
it is more like a dictionary. And it has no factory block.
If you don't know LRUCache, it's a fixed size dictionary that sorts its
elements by usage in a "Least Recently Used" fashion. Meaning the last used
element is put in front and the least used at the end. Elements get discarded
at the end if space is full.
Apart from #at: that is provided by LRUCache , LRUDictionary implements to
following methods
at:ifAbsent:
at:ifAbsentPut:
at:ifPresent:
at:put:
removeAt:
removeKey:
removeKey:ifAbsent
It is available here
MCHttpRepository
location: 'http://source.selfish.org/mc/misc'
user: ''
password: ''
Blog article is here
http://norbert.hartl.name/blog/lrudictionary/
hope you like it,
Norbert