io.inversion.redis.RedisDb Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2015-2019 Rocket Partners, LLC
* https://github.com/inversion-api
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.inversion.redis;
import io.inversion.ApiException;
import io.inversion.Collection;
import io.inversion.Db;
import io.inversion.Results;
import io.inversion.rql.Term;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
import java.util.List;
import java.util.Map;
public class RedisDb extends Db {
protected final Logger log = LoggerFactory.getLogger(getClass());
protected transient JedisPool jedis = null;
// configurable props
protected String host = null;
protected int port = 6379;
protected int poolMin = 16;
protected int poolMax = 128;
protected boolean testOnBorrow = true;
protected boolean testOnReturn = true;
protected boolean testWhileIdle = true;
protected int minEvictableIdleTimeMillis = 60000;
protected int timeBetweenEvictionRunsMillis = 30000;
protected int numTestsPerEvictionRun = 3;
protected boolean blockWhenExhausted = true;
protected String nocacheParam = "nocache";
protected int readSocketTimeout = 2500; // time in milliseconds
protected int ttl = 15552000; // time to live 15,552,000s == 180 days
@Override
public Results doSelect(Collection table, List queryTerms) throws ApiException {
// TODO Auto-generated method stub
return null;
}
@Override
public List doUpsert(Collection table, List