add class for caching
use serialize instead of json
auto write
add caching