Code example for LoadingCache

Methods: get

0
        if (valueid == null) {
            return Optional.absent();
        } 
 
        try { 
            return Optional.fromNullable(definition.getCache(clazz, key).get(valueid));
        } catch (CacheLoader.InvalidCacheLoadException e) {
            // this exception is raised when cache loader returns null, which may happen if the object behind the key 
            // is deleted. Therefore we just return an absent value 
            return Optional.absent();
        } catch (ExecutionException e) {
            throw new RuntimeException(
                    "impossible to load object from cache using valueid " + valueid + " for " + key + ": " + e.getMessage(), e);
        } 
    } 
 
    public RestxSession expires(Duration duration) { 
        return mayUpdateCurrent(new RestxSession(definition, valueidsByKey, principal, duration));
    } 
 
    public Duration getExpires() {