Code example for Cache

Methods: put

0
    @POST 
    @Consumes("application/json") 
    public Response post(RecordScan scan, @Context UriInfo uriInfo) {
        String scanId = String.valueOf(rand.nextLong());
        try { 
            recordScannerMap.put(scanId, getTable(uriInfo).getScanner(scan));
        } catch (RepositoryException e) {
           throw new ResourceException(e, Status.BAD_REQUEST.getStatusCode());
        } catch (InterruptedException e) {
            throw new ResourceException(e, Status.INTERNAL_SERVER_ERROR.getStatusCode());
        } 
        URI uri = uriInfo.getBaseUriBuilder().path(RecordScanResource.class).build(scanId);
        return Response.created(uri).build();
    } 
}