public abstract class

AbstractKinveyCachedClientRequest

extends AbstractKinveyOfflineClientRequest<T>
java.lang.Object
   ↳ java.util.AbstractMap<K, V>
     ↳ com.google.api.client.util.GenericData
       ↳ com.kinvey.java.core.AbstractKinveyClientRequest<T>
         ↳ com.kinvey.java.core.AbstractKinveyJsonClientRequest<T>
           ↳ com.kinvey.java.offline.AbstractKinveyOfflineClientRequest<T>
             ↳ com.kinvey.java.cache.AbstractKinveyCachedClientRequest<T>
Known Direct Subclasses

Class Overview

Implementation of a Client Request, which can either pull a response from a Cache instance or from online.

Behavior is determined by a CachePolicy, which must be set along with an instance of a Cache.

This class provides all available functionality through public methods, but most of the implementation is handled by the specified cache policy.

Summary

Public Methods
T execute()
@return
T fromCache()
This method retrieves an entity from the cache.
T fromService(boolean persist)
This method retrieves an entity from the service.
KinveyClientCallback<T> getCallback()
void setCallback(KinveyClientCallback<T> callback)
[Expand]
Inherited Methods
From class com.kinvey.java.offline.AbstractKinveyOfflineClientRequest
From class com.kinvey.java.core.AbstractKinveyJsonClientRequest
From class com.kinvey.java.core.AbstractKinveyClientRequest
From class com.google.api.client.util.GenericData
From class java.util.AbstractMap
From class java.lang.Object
From interface java.util.Map

Public Methods

public T execute ()

@return

Throws
IOException

public T fromCache ()

This method retrieves an entity from the cache. The complete URL of the request is used as a key in the cache.

This method is synchronized on an object lock, providing threadsafe accesss to the cache.

Returns
  • an entity or null, from the cache
Throws
IOException

public T fromService (boolean persist)

This method retrieves an entity from the service. The request is executed as normal, and, if persisted, the response can be added to the cache.

Parameters
persist - true if the response should be added to the cache, false if the cache shouldn't be updated.
Returns
  • an entity from the online collection..
Throws
IOException

public KinveyClientCallback<T> getCallback ()

public void setCallback (KinveyClientCallback<T> callback)