Class SiteCacheRestController
java.lang.Object
org.craftercms.core.controller.rest.RestControllerBase
org.craftercms.engine.controller.rest.SiteCacheRestController
@CrafterRestController
@RequestMapping("${crafter.core.rest.base.uri}/site/cache")
public class SiteCacheRestController
extends org.craftercms.core.controller.rest.RestControllerBase
REST controller for site cache operations. The controller uses a map of cache types mapped to
SiteCacheRestOperations
, which allows REST operation
implementations for different types of caches.- Author:
- avasquez
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map
<String, SiteCacheRestOperations> protected String
protected String
static final String
static final String
static final String
Fields inherited from class org.craftercms.core.controller.rest.RestControllerBase
MESSAGE_MODEL_ATTRIBUTE_NAME, REST_BASE_URI
-
Constructor Summary
ConstructorsConstructorDescriptionSiteCacheRestController
(Map<String, SiteCacheRestOperations> cacheRestOperationsPerCacheType, String defaultCacheType, String configuredToken) -
Method Summary
Modifier and TypeMethodDescriptionprotected SiteCacheRestOperations
getCacheRestOperations
(String cacheType) org.craftercms.core.cache.CacheStatistics
getStatistics
(String token, String cacheType) protected final void
validateToken
(String requestToken) Methods inherited from class org.craftercms.core.controller.rest.RestControllerBase
createResponseMessage, createSingletonModifiableMap
-
Field Details
-
URL_ROOT
- See Also:
-
URL_CLEAR
- See Also:
-
URL_STATS
- See Also:
-
cacheRestOperationsPerCacheType
-
defaultCacheType
-
configuredToken
-
-
Constructor Details
-
SiteCacheRestController
@ConstructorProperties({"cacheRestOperationsPerCacheType","defaultCacheType","configuredToken"}) public SiteCacheRestController(Map<String, SiteCacheRestOperations> cacheRestOperationsPerCacheType, String defaultCacheType, String configuredToken)
-
-
Method Details
-
clear
@RequestMapping(value="/clear", method=GET) public Map<String,Object> clear(jakarta.servlet.http.HttpServletRequest request, @RequestParam String token, @RequestParam(required=false) String cacheType) throws org.craftercms.commons.exceptions.InvalidManagementTokenException - Throws:
org.craftercms.commons.exceptions.InvalidManagementTokenException
-
getStatistics
@RequestMapping(value="/statistics", method=GET) public org.craftercms.core.cache.CacheStatistics getStatistics(@RequestParam String token, @RequestParam(required=false) String cacheType) throws org.craftercms.commons.exceptions.InvalidManagementTokenException - Throws:
org.craftercms.commons.exceptions.InvalidManagementTokenException
-
handleInvalidCacheTypeException
@ExceptionHandler(InvalidCacheTypeException.class) public org.springframework.http.ResponseEntity<Map<String,Object>> handleInvalidCacheTypeException(InvalidCacheTypeException ex) -
getCacheRestOperations
-
validateToken
protected final void validateToken(String requestToken) throws org.craftercms.commons.exceptions.InvalidManagementTokenException - Throws:
org.craftercms.commons.exceptions.InvalidManagementTokenException
-