Changed cache logic. API changed! Encode now accepts 'refresh' parameter for caching control.