On Thursday, 14 November 2013 at 17:36:09 UTC, Jacek Furmankiewicz wrote:
In our Java code, we make heavy use of ConcurrentHashMap for in-memory caches:

http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html

We use it mostly for in-memory caches. A background thread wakes up every X seconds and resyncs the cache with whatever changes occurred in the DB. In the meantime, all the incoming requests can read from the same cache without any concurrency issues and excellent performance.

All the major Java Map implementations also support the NavigableMap interface:

http://docs.oracle.com/javase/7/docs/api/java/util/NavigableMap.html

which allows you to get the key closest to the one you are looking for (either up or down). This is very useful when you have hierarchies of business rules that have effective date ranges and you are trying to find which rules is active on a particular day.

I read up the chapter on associative arrays in D, but I do not see anything similar to this functionality in there.

Could anyone point me to what would be the closest D equivalents (maybe in an external library if not part of Phobos) so we can playing around with them?

Much appreciated
Jacek

D does not have alot of diffrent containers atm. This work has been postponed until a working version of std.allocators is implemented. So atleast in the phobos library right now you will not find what you are looking for.

Reply via email to