Extract safe_cache_key method out and put its logic into the strategy