Code example for Cache

Methods: getIfPresentput

0
 
    private static Model getOrLoadModel(Slice slice)
    { 
        HashCode modelHash = ModelUtils.modelHash(slice);
 
        Model model = MODEL_CACHE.getIfPresent(modelHash);
        if (model == null) {
            model = ModelUtils.deserialize(slice);
            MODEL_CACHE.put(modelHash, model);
        } 
 
        return model;
    } 
 
    @ScalarFunction 
    @SqlType(MAP_BIGINT_DOUBLE)
    public static Slice features(@SqlType(StandardTypes.DOUBLE) double f1)
    { 
        return featuresHelper(f1);
    } 
Connect your IDE to all the code out there  Get Codota for Java