001package gu.sql2java; 002 003import gu.sql2java.Constant.UpdateStrategy; 004import gu.sql2java.exception.ObjectRetrievalException; 005 006public interface IKeyCache<B extends BaseBean> { 007 /** 008 * 删除cache中指定的记录 009 * @param bean 010 */ 011 public void remove(B bean); 012 /** 013 * 根据指定的更新策略更新{@code bean}到指定的缓存对象{@code cacheMap} 014 * @param bean 015 * @param updateStrategy 更新策略 016 */ 017 public void update(B bean, UpdateStrategy updateStrategy); 018 /** 019 * 根据默认更新策略向cache中更新数据 020 * @param bean 021 * @see Constant.UpdateStrategy 022 */ 023 public void update(B bean); 024 /** 025 * 加载主键或索引(keys)指定的记录,如果缓存中没有则从数据库中查询<br> 026 * 数据库中没有找到则抛出异常 027 * @param keys primary keys 028 * @return B 029 * @throws ObjectRetrievalException 030 */ 031 public B getBean(Object... keys)throws ObjectRetrievalException; 032 /** 033 * 加载主键或索引(keys)指定的记录,如果缓存中没有则从数据库中查询<br> 034 * 数据库中没有找到则返回{@code null} 035 * @param keys primary keys 036 * @return B 037 */ 038 public B getBeanUnchecked(Object... keys); 039}