@Override public Long getScore(T t) { try { Long score = getRao().zscore(t); if (score != null) { return score; } } catch (Exception e) { logger.warn("index cache error", e); } Long score = null; List<T> ts = getDao().query(t, null, t.getConditionsOfQueryAll()); if (ts != null && !ts.isEmpty()) { for (T et : ts) { if (t.equalIndex(et)) { score = et.getScore(); } fillScore(et); } } try { getRao().zaddall(t.getHashKey(), t.getKeyType(), ts); } catch (Exception e) { logger.warn("index cache error", e); } return score; }
@Override public boolean exist(T t) { Boolean exist = null; try { exist = getRao().exist(t); if (exist != null) { return exist; } } catch (Exception e) { logger.warn("index cache error", e); } exist = false; List<T> ts = getDao().query(t, null, t.getConditionsOfQueryAll()); if (ts != null && !ts.isEmpty()) { for (T et : ts) { if (t.equalIndex(et)) { exist = true; } fillScore(et); } } try { getRao().zaddall(t.getHashKey(), t.getKeyType(), ts); } catch (Exception e) { logger.warn("index cache error", e); } return exist; }