thread safe cache with memory and filesystem layers