digitalmars.D.learn - Thread-safe cache
- bauss (13/13) May 02 2018 What would the most performent way to create a thread-safe cache
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 possible. 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 database. 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.
May 02 2018