add astream cache
move writ and read mode to stream base