예제 #1
0
 @GET
 @Path("/clearMybatisCache")
 @Produces({"application/json"})
 public Response clearCache(@QueryParam("key") String param1) {
   String appkey = Config.Current().Database.AppKey.Value;
   if (param1 == null) {
     return Response.status(200).entity("Please provide the pass key.").build();
   }
   if (param1.equals(appkey)) {
     try {
       MyBatis.SessionFactory.ClearCache();
     } catch (Exception e) {
       log.error("Unable to Clear Cache");
       return Response.status(200).entity("Unable to remove Cache").build();
     }
     Config.ClearConfig();
     return Response.status(200).entity("Removed Cache").build();
   } else {
     return Response.status(200).entity("Invalid Key").build();
   }
 }