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; }
@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; }
/** * Add an object into cache by key. The key will be used in conjunction with session id if * there is a session instance * * @param key * the key to index the object within the cache * @param obj * the object to be cached */ public void cache(String key, Object obj) { H.Session sess = session(); if (null != sess) { sess.cache(key, obj); } else { app().cache().put(key, obj); } }
/** * Add an object into cache by key with expiration time specified * * @param key * the key to index the object within the cache * @param obj * the object to be cached * @param expiration * the seconds after which the object will be evicted from the cache */ public void cache(String key, Object obj, int expiration) { H.Session session = this.session; if (null != session) { session.cache(key, obj, expiration); } else { app().cache().put(key, obj, expiration); } }
/** * Add an object into cache by key with expiration time specified * * @param key * the key to index the object within the cache * @param obj * the object to be cached * @param expiration * the seconds after which the object will be evicted from the cache */ public void cache(String key, Object obj, int expiration) { H.Session session = this.session; if (null != session) { session.cache(key, obj, expiration); } else { app().cache().put(key, obj, expiration); } }
/** * Add an object into cache by key. The key will be used in conjunction with session id if * there is a session instance * * @param key * the key to index the object within the cache * @param obj * the object to be cached */ public void cache(String key, Object obj) { H.Session sess = session(); if (null != sess) { sess.cache(key, obj); } else { app().cache().put(key, obj); } }
@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; }
@Override public CliSession attribute(String key, Object val) { session.cache(key, val, app.config().sessionTtl()); return this; }
@Override public <T> void put(String key, T t) { ActionContext actionContext = ActionContext.current(); if (null != actionContext) { actionContext.session().cache(key, t, TTL); } CliContext cliContext = CliContext.current(); if (null != cliContext) { CliSession cliSession = cliContext.session(); cliSession.attribute(key, t); } }
@Override public <T> void put(String key, T t) { ActionContext actionContext = ActionContext.current(); if (null != actionContext) { actionContext.session().cache(key, t, TTL); } CliContext cliContext = CliContext.current(); if (null != cliContext) { CliSession cliSession = cliContext.session(); cliSession.attribute(key, t); } }
@Override public CliSession attribute(String key, Object val) { session.cache(key, val, app.config().sessionTtl()); return this; }