fix logic for caching model cache_key