making db cache lockless and copy and write