private List<String> mru() { List<String> mru = session.cached("cli_over_http_mru"); if (null == mru) { mru = new ArrayList<>(); } session.cache("cli_over_http_mru", mru, config.sessionTtl()); return mru; }
private List<String> mru() { List<String> mru = session.cached("cli_over_http_mru"); if (null == mru) { mru = new ArrayList<>(); } session.cache("cli_over_http_mru", mru, config.sessionTtl()); return mru; }
private void preventDoubleSubmission(ActionContext context) { if (null == dspToken) { return; } H.Request req = context.req(); if (req.method().safe()) { return; } String tokenValue = context.paramVal(dspToken); if (S.blank(tokenValue)) { return; } H.Session session = context.session(); String cacheKey = S.concat("DSP-", dspToken); String cached = session.cached(cacheKey); if (S.eq(tokenValue, cached)) { throw Conflict.get(); } session.cacheFor1Min(cacheKey, tokenValue); }
@Override public <T> T get(String key) { ActionContext actionContext = ActionContext.current(); if (null != actionContext) { H.Session session = actionContext.session(); T t = session.cached(key); if (null != t) { session.cache(key, t, TTL); } return t; } CliContext cliContext = CliContext.current(); if (null != cliContext) { CliSession cliSession = cliContext.session(); return cliSession.attribute(key); } return null; }
private void preventDoubleSubmission(ActionContext context) { if (null == dspToken) { return; } H.Request req = context.req(); if (req.method().safe()) { return; } String tokenValue = context.paramVal(dspToken); if (S.blank(tokenValue)) { return; } H.Session session = context.session(); String cacheKey = S.concat("DSP-", dspToken); String cached = session.cached(cacheKey); if (S.eq(tokenValue, cached)) { throw Conflict.get(); } session.cacheFor1Min(cacheKey, tokenValue); }
/** * Return cached object by key. The key will be concatenated with * current session id when fetching the cached object * * @param key * @param <T> * the object type * @return the cached object */ public <T> T cached(String key) { H.Session sess = session(); if (null != sess) { return sess.cached(key); } else { return app().cache().get(key); } }
@Override public <T> T get(String key) { ActionContext actionContext = ActionContext.current(); if (null != actionContext) { H.Session session = actionContext.session(); T t = session.cached(key); if (null != t) { session.cache(key, t, TTL); } return t; } CliContext cliContext = CliContext.current(); if (null != cliContext) { CliSession cliSession = cliContext.session(); return cliSession.attribute(key); } return null; }
/** * Return cached object by key. The key will be concatenated with * current session id when fetching the cached object * * @param key * @param <T> * the object type * @return the cached object */ public <T> T cached(String key) { H.Session sess = session(); if (null != sess) { return sess.cached(key); } else { return app().cache().get(key); } }
@Override public <T> T attribute(String key) { return session.cached(key); }
@Override public <T> T attribute(String key) { return session.cached(key); }