add cache related code
commit by joey
add security related code
big change