public < T > void cancel ( final Class < T > clazz , final Object requestCacheKey ) { final SpiceRequest < T > request = new SpiceRequest < T > ( clazz ) { @ Override public T loadDataFromNetwork ( ) throws Exception { return null ; } } ; final CachedSpiceRequest < T > cachedSpiceRequest = new CachedSpiceRequest < T > ( request , requestCacheKey , DurationInMillis . ALWAYS_EXPIRED ) ; cachedSpiceRequest . setProcessable ( false ) ; cachedSpiceRequest . setOffline ( true ) ; cachedSpiceRequest . cancel ( ) ; execute ( cachedSpiceRequest , null ) ; }
Cancel a pending request if it exists . If no such request exists this method does nothing . If a request identified by clazz and requestCacheKey exists it will be cancelled and its associated listeners will get notified . This method is asynchronous .