List<CacheEntry> getCacheEntries()
throws ArchivaRestServiceException;
+ @Path( "clearCache/{key}" )
+ @GET
+ @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML } )
+ @RedbackAuthorization( permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION )
+ Boolean clearCache( @PathParam( "key" ) String cacheKey )
+ throws ArchivaRestServiceException;
+
}
return cacheEntries;
}
+
+ public Boolean clearCache( String cacheKey )
+ throws ArchivaRestServiceException
+ {
+ Cache cache = caches.get( cacheKey );
+ if ( cache == null )
+ {
+ throw new ArchivaRestServiceException( "no cache for key: " + cacheKey,
+ Response.Status.BAD_REQUEST.getStatusCode() );
+ }
+
+ cache.clear();
+ return Boolean.TRUE;
+ }
}
system-status.queues.grid.header.key=Queue
system-status.queues.grid.header.number=Size
system-status.header.main=System Status
+system-status.caches.grid.header.cacheHits=Hits
+system-status.queues.grid.header.size=Size
+system-status.caches.grid.header.cacheMiss=Misses
+system-status.caches.grid.header.cacheHitRate=Hit Ratio
+system-status.caches.grid.header.flush=Flush
+system-status.caches.grid.header.key=Cache
+system-status.caches.flushed=Cache {0} flushed.
+system-status.caches.grid.header.size=Size
});
}
+ flushCache=function(key){
+ clearUserMessages();
+ $("#main-content #status_caches").html(smallSpinnerImg());
+ $.ajax("restServices/archivaServices/systemStatusService/clearCache/"+encodeURIComponent(key), {
+ type: "GET",
+ success: function(data){
+ displaySuccessMessage( $.i18n.prop("system-status.caches.flushed",key));
+ displayCacheEntries();
+ }
+ });
+ }
+
displaySystemStatus=function(){
screenChange();
var mainContent=$("#main-content");
<th>${$.i18n.prop('system-status.caches.grid.header.cacheHits')}</th>
<th>${$.i18n.prop('system-status.caches.grid.header.cacheMiss')}</th>
<th>${$.i18n.prop('system-status.caches.grid.header.cacheHitRate')}</th>
+ <th>${$.i18n.prop('system-status.caches.grid.header.flush')}</th>
</tr>
</thead>
<tbody>
<td>${cacheEntry.cacheHits}</td>
<td>${cacheEntry.cacheMiss}</td>
<td>${cacheEntry.cacheHitRate}</td>
+ <td>
+ <a href="#" onclick="flushCache('${cacheEntry.key}')">
+ {{if cacheEntry.size > 0 }}
+ <img src="images/user-trash-full.png"/>
+ {{else}}
+ <img src="images/user-trash.png"/>
+ {{/if}}
+ </a>
+ </td>
</tr>
{{/each}}
</tbody>