|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shindig.gadgets.http.AbstractHttpCache
public abstract class AbstractHttpCache
Base class for content caches. Defines cache expiration rules and
and restrictions on allowed content.
Implementations that override this are discouraged from using custom cache keys unless there is
actually customization in the request object itself. It is highly recommended that you still
use createKey(org.apache.shindig.gadgets.http.HttpRequest) in the base class and append any custom data to the end of the key instead
of building your own keys from scratch.
| Constructor Summary | |
|---|---|
AbstractHttpCache()
|
|
| Method Summary | |
|---|---|
boolean |
addResponse(HttpRequest request,
HttpResponse response)
Add a request/response pair to the cache. |
protected abstract void |
addResponseImpl(String key,
HttpResponse response)
|
String |
createKey(HttpRequest request)
Produce a key from the given request. |
protected static String |
getAppUrl(HttpRequest request)
|
protected static String |
getInstanceId(HttpRequest request)
|
protected static String |
getOwnerId(HttpRequest request)
|
HttpResponse |
getResponse(HttpRequest request)
|
protected abstract HttpResponse |
getResponseImpl(String key)
|
protected static String |
getServiceName(HttpRequest request)
|
protected static String |
getTokenName(HttpRequest request)
|
protected static String |
getTokenOwner(HttpRequest request)
|
protected static String |
getViewerId(HttpRequest request)
|
protected boolean |
isCacheable(HttpRequest request)
|
protected boolean |
isCacheable(HttpRequest request,
HttpResponse response)
|
HttpResponse |
removeResponse(HttpRequest request)
|
protected abstract HttpResponse |
removeResponseImpl(String key)
|
protected boolean |
responseStillUsable(HttpResponse response)
Utility function to verify that an entry is usable The cache still serve staled data, it is the responsible of the user to decide if to use it or not (use isStale). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AbstractHttpCache()
| Method Detail |
|---|
protected abstract HttpResponse getResponseImpl(String key)
protected abstract void addResponseImpl(String key,
HttpResponse response)
protected abstract HttpResponse removeResponseImpl(String key)
public final HttpResponse getResponse(HttpRequest request)
getResponse in interface HttpCache
public boolean addResponse(HttpRequest request,
HttpResponse response)
HttpCache
addResponse in interface HttpCachepublic HttpResponse removeResponse(HttpRequest request)
removeResponse in interface HttpCacheprotected boolean isCacheable(HttpRequest request)
protected boolean isCacheable(HttpRequest request,
HttpResponse response)
public String createKey(HttpRequest request)
null,
depending on authentication rules. See individual methods for details. New cache key items
should always be inserted using CacheKeyBuilder#setParam(String, Object).
createKey in interface HttpCacheprotected static String getOwnerId(HttpRequest request)
protected static String getViewerId(HttpRequest request)
protected static String getTokenOwner(HttpRequest request)
protected static String getAppUrl(HttpRequest request)
protected static String getInstanceId(HttpRequest request)
protected static String getServiceName(HttpRequest request)
protected static String getTokenName(HttpRequest request)
protected boolean responseStillUsable(HttpResponse response)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||