def withOptionalRedis()

in plugin/src/main/groovy/grails/plugins/redis/RedisService.groovy [119:139]


    def withOptionalRedis(Closure clos) {
        Jedis redis
        try {
            redis = redisPool.resource
        }
        catch (JedisConnectionException jce) {
            log.info('Unreachable redis store trying to retrieve redis resource. Please check redis server and/or config!')
        }

        try {
            return clos(redis)
        } catch (JedisConnectionException jce) {
            log.error('Unreachable redis store trying to return redis pool resource. Please check redis server and/or config!', jce)
        } catch (Throwable t) {
            throw t
        } finally {
            if (redis) {
                redis.close()
            }
        }
    }