simple cache writing/reading