コード例 #1
0
  /** @param args */
  public static void main(String[] args) {
    AppUtil appUtil = new AppUtil();
    ModelCacheManager modelCacheManager =
        (ModelCacheManager) appUtil.getComponentInstance("modelCacheManager");
    MyModel myModel = new MyModel();
    myModel.setId(new Long(123));
    myModel.setName("test");
    modelCacheManager.saveCache(myModel.getId(), MyModel.class.getName(), myModel);
    if (modelCacheManager.containInCache(myModel.getId(), MyModel.class.getName()))
      System.out.print("ok");
    else System.out.print("no");

    ModelManager modelManager = (ModelManager) appUtil.getComponentInstance("modelManager");
    ModelKey modelKey = new ModelKey(myModel.getId(), MyModel.class);
    if (modelManager.containInCache(modelKey)) System.out.print("ok");
    else System.out.print("no");
  }
コード例 #2
0
 @Around
 public MyModel getModel(Long key) {
   MyModel mym = new MyModel();
   mym.setId(key);
   return mym;
 }