rewrite the cache handler put to support all cases

move test cases from data store to cache handler file