Pure JSON database?
"There is no silver bullet" as it is already known. Thus, potentially your lazy initialized uber-clever-code might keep a lot of memory in use.
This is a classical performance vs resilience balance. The balance one has to perpetually and skillfully watch while using powerful programming languages like standard C++ is.
In case you like to experiment and learn modern C++, you will be needing some R&D little nuggets of your own.
In 2010, I was an idealist, I admit. But only about software that is. Hardware prophecy has been fulfilled.
C++? Hint: What matters is Time To Market (TTM) and Return On Investment (ROI).