Thread-safe cache

bauss jj_1337 at
Wed May 2 17:27:35 UTC 2018

What would the most performent way to create a thread-safe cache 
that can be used across threads/fibers in D? Lock-free as much as 

What I ultimately want to do is to cache some data I pull from a 
database (Or elsewhere for that matter) and then cache it 
somewhere, so I can avoid having multiple calls to eg. the 

Of course I can use an associative array and then put a 
synchronize statement around it, but it's not performant and it 
can have a huge performance impact when using fibers ex. with 
vibe.d since a single connection can end up blocking multiple 
connections, just by the fact that single connection is 
attempting to access that piece of data.

More information about the Digitalmars-d-learn mailing list