Refactored cache expiration