001/*******************************************************************************
002 * Copyright (c) 2006-2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 ******************************************************************************/
009package org.nuxeo.ecm.core.redis;
010
011import java.io.IOException;
012
013import redis.clients.jedis.Jedis;
014import redis.clients.jedis.exceptions.JedisException;
015import redis.clients.util.Pool;
016
017/**
018 * Execute the jedis statement
019 *
020 * @since 6.0
021 */
022public interface RedisExecutor {
023
024    public static final RedisExecutor NOOP = new RedisExecutor() {
025
026        @Override
027        public <T> T execute(RedisCallable<T> call) throws JedisException {
028            throw new UnsupportedOperationException("No redis executor available");
029        }
030
031        @Override
032        public Pool<Jedis> getPool() {
033            throw new UnsupportedOperationException("No pool available");
034        }
035
036        @Override
037        public boolean supportPipelined() {
038            return false;
039        }
040
041    };
042
043    <T> T execute(RedisCallable<T> call) throws JedisException;
044
045    Pool<Jedis> getPool();
046
047    /**
048     * Is the executor support pipelined operations
049     * @since 7.4
050     */
051    boolean supportPipelined();
052}