假设我有一个域类
class Profile{
    String name
    byte[] logo
}
和一个控制器:
class ImageController {
    def renderImage ={
       def image = Profile.get(params.id).logo
       if (image) {
            response.setContentLength(image.length)
            response.getOutputStream().write(image)
        } else {
             response.sendError(404)
        }    
    }
}
和普惠制:
 <img width="48" 
      height="48"
      src="${createLink(controller: 'image', action: 'renderImage', id: 1)}">
好的,到目前为止一切都很好。图像渲染得很好,我很高兴。但是,由于 gsp 片段是我的主要布局的一部分,因此每次重新加载页面时都会呈现图像。
我的问题:有没有办法缓存这个图像(blob mysql)?我打开了二级缓存等。但我不确定图像是否被缓存。你会怎么做?
谢谢。