separated queue and cache. added tests