Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.hubspot.chrome.devtools.client.core.cachestorage;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hubspot.chrome.devtools.base.ChromeRequest;
import com.hubspot.chrome.devtools.base.ChromeSessionCore;
import java.util.List;
import java.util.concurrent.CompletableFuture;
public final class CacheStorage {
ChromeSessionCore chromeSession;
ObjectMapper objectMapper;
public CacheStorage(ChromeSessionCore chromeSession, ObjectMapper objectMapper) {
this.chromeSession = chromeSession;
this.objectMapper = objectMapper;
}
/**
* Deletes a cache.
*
* @param cacheId Id of cache for deletion.
*/
public void deleteCache(CacheId cacheId) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.deleteCache");
chromeRequest
.putParams("cacheId", cacheId);
chromeSession.send(chromeRequest);
}
/**
* Deletes a cache.
*
* @param cacheId Id of cache for deletion.
*/
public void deleteCacheAsync(CacheId cacheId) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.deleteCache");
chromeRequest
.putParams("cacheId", cacheId);
chromeSession.sendAsync(chromeRequest);
}
/**
* Deletes a cache entry.
*
* @param cacheId Id of cache where the entry will be deleted.
* @param request URL spec of the request.
*/
public void deleteEntry(CacheId cacheId, String request) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.deleteEntry");
chromeRequest
.putParams("cacheId", cacheId)
.putParams("request", request);
chromeSession.send(chromeRequest);
}
/**
* Deletes a cache entry.
*
* @param cacheId Id of cache where the entry will be deleted.
* @param request URL spec of the request.
*/
public void deleteEntryAsync(CacheId cacheId, String request) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.deleteEntry");
chromeRequest
.putParams("cacheId", cacheId)
.putParams("request", request);
chromeSession.sendAsync(chromeRequest);
}
/**
* Requests cache names.
*
* @param securityOrigin Security origin.
*/
public List requestCacheNames(String securityOrigin) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.requestCacheNames");
chromeRequest
.putParams("securityOrigin", securityOrigin);
return chromeSession.send(chromeRequest, new TypeReference>(){});
}
/**
* Requests cache names.
*
* @param securityOrigin Security origin.
*/
public CompletableFuture> requestCacheNamesAsync(String securityOrigin) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.requestCacheNames");
chromeRequest
.putParams("securityOrigin", securityOrigin);
return chromeSession.sendAsync(chromeRequest, new TypeReference>(){});
}
/**
* Fetches cache entry.
*
* @param cacheId Id of cache that contains the enty.
* @param requestURL URL spec of the request.
*/
public CachedResponse requestCachedResponse(CacheId cacheId, String requestURL) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.requestCachedResponse");
chromeRequest
.putParams("cacheId", cacheId)
.putParams("requestURL", requestURL);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Fetches cache entry.
*
* @param cacheId Id of cache that contains the enty.
* @param requestURL URL spec of the request.
*/
public CompletableFuture requestCachedResponseAsync(CacheId cacheId,
String requestURL) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.requestCachedResponse");
chromeRequest
.putParams("cacheId", cacheId)
.putParams("requestURL", requestURL);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
/**
* Requests data from cache.
*
* @param cacheId ID of cache to get entries from.
* @param skipCount Number of records to skip.
* @param pageSize Number of records to fetch.
*/
public RequestEntriesResult requestEntries(CacheId cacheId, Integer skipCount, Integer pageSize) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.requestEntries");
chromeRequest
.putParams("cacheId", cacheId)
.putParams("skipCount", skipCount)
.putParams("pageSize", pageSize);
return chromeSession.send(chromeRequest, new TypeReference(){});
}
/**
* Requests data from cache.
*
* @param cacheId ID of cache to get entries from.
* @param skipCount Number of records to skip.
* @param pageSize Number of records to fetch.
*/
public CompletableFuture requestEntriesAsync(CacheId cacheId,
Integer skipCount, Integer pageSize) {
ChromeRequest chromeRequest = new ChromeRequest("CacheStorage.requestEntries");
chromeRequest
.putParams("cacheId", cacheId)
.putParams("skipCount", skipCount)
.putParams("pageSize", pageSize);
return chromeSession.sendAsync(chromeRequest, new TypeReference(){});
}
}