Add thread concurrency support to make writeing more fast. 

There is n caches which are thread safe and without mutex, if one of these caches is full the thread last to write into cache will write whole cache in to file and at the same time the next cache will be filled by another threads.

So how exactly is it that the cache is thread safe without any mutex? It is quite easy, for every cache there are two atomic indexes. First of them is "locked index" by incrementing this atomic index the thread wil acquire one index (position) inside cache where it can write without need to lock whole cache. The second index indicate the written data so the ls who wil written it's data into cache wil write whole cache in to file.