optimize insert_cache_item function to reduce memcpy size