add codes and cache mechanism

In Progress