Package redis.clients.jedis

Examples of redis.clients.jedis.Jedis.expire()


            long begin = System.currentTimeMillis();
            // 操作setnx与expire成功返回1,失败返回0,仅当均返回1时,实际操作成功
            Long result = jedis
                    .setnx(SafeEncoder.encode(key), serialize(value));
            if (expiration > 0) {
                result = result & jedis.expire(key, expiration);
            }
            long end = System.currentTimeMillis();
            if (result == 1L) {
                LOG.info("add key:" + key + " spends: " + (end - begin)
                        + " millionseconds.");
View Full Code Here


     */
    public boolean expire(String key, int seconds) {
        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();
            jedis.expire(SafeEncoder.encode(key), seconds);
            LOG.info("expire key:" + key + " time after " + seconds
                    + " seconds.");

            return true;
        } catch (Exception e) {
View Full Code Here

                            ByteArrayOutputStream output = new ByteArrayOutputStream();
                            ObjectOutput value = getSerialization(url).serialize(url, output);
                            value.writeObject(invocation.getArguments()[1]);
                            resource.set(key, output.toByteArray());
                            if (expiry > 1000) {
                                resource.expire(key, expiry / 1000);
                            }
                            return new RpcResult();
                        } else if (delete.equals(invocation.getMethodName())) {
                            if (invocation.getArguments().length != 1) {
                                throw new IllegalArgumentException("The redis delete method arguments mismatch, must only one arguments. interface: " + type.getName() + ", method: " + invocation.getMethodName() + ", url: " + url);
View Full Code Here

            long begin = System.currentTimeMillis();
            // 操作setnx与expire成功返回1,失败返回0,仅当均返回1时,实际操作成功
            Long result = jedis
                    .setnx(SafeEncoder.encode(key), serialize(value));
            if (expiration > 0) {
                result = result & jedis.expire(key, expiration);
            }
            long end = System.currentTimeMillis();
            if (result == 1L) {
                LOG.info("add key:" + key + " spends: " + (end - begin)
                        + " millionseconds.");
View Full Code Here

     */
    public boolean expire(String key, int seconds) {
        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();
            jedis.expire(SafeEncoder.encode(key), seconds);
            LOG.info("expire key:" + key + " time after " + seconds
                    + " seconds.");

            return true;
        } catch (Exception e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.