redis队列操作
来源:互联网 发布:国税总局网络 编辑:程序博客网 时间:2024/05/22 03:47
jedis-2.7.0.jar
添加
/** * Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key. If the key * does not exist an empty list is created just before the append operation. If the key exists but * is not a List an error is returned. * <p> * Time complexity: O(1) * @param key * @param strings * @return Integer reply, specifically, the number of elements inside the list after the push * operation. */ public Long rpush(final String key, final String... strings) { checkIsInMulti(); client.rpush(key, strings); return client.getIntegerReply(); } /** * Add the string value to the head (LPUSH) or tail (RPUSH) of the list stored at key. If the key * does not exist an empty list is created just before the append operation. If the key exists but * is not a List an error is returned. * <p> * Time complexity: O(1) * @param key * @param strings * @return Integer reply, specifically, the number of elements inside the list after the push * operation. */ public Long lpush(final String key, final String... strings) { checkIsInMulti(); client.lpush(key, strings); return client.getIntegerReply(); }
弹出
/** * Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example * if the list contains the elements "a","b","c" LPOP will return "a" and the list will become * "b","c". * <p> * If the key does not exist or the list is already empty the special value 'nil' is returned. * @see #rpop(String) * @param key * @return Bulk reply */ public String lpop(final String key) { checkIsInMulti(); client.lpop(key); return client.getBulkReply(); } /** * Atomically return and remove the first (LPOP) or last (RPOP) element of the list. For example * if the list contains the elements "a","b","c" RPOP will return "c" and the list will become * "a","b". * <p> * If the key does not exist or the list is already empty the special value 'nil' is returned. * @see #lpop(String) * @param key * @return Bulk reply */ public String rpop(final String key) { checkIsInMulti(); client.rpop(key); return client.getBulkReply(); }
阅读全文
0 0
- redis队列操作
- 用php操作redis队列实例讲解
- redis 队列操作的例子(php)
- 针对Redis队列的理解,实例操作
- redis 队列操作的例子(php)
- 使用jedis操作redis消息队列
- PHP操作 Redis队列简单示例
- redis 队列
- redis 队列
- Redis 队列
- Redis队列——PHP操作简单示例
- Redis队列——PHP操作简单示例
- Redis队列——PHP操作简单示例
- Redis应用3-基于Redis消息队列实现的异步操作
- 队列操作
- 队列操作
- 队列操作
- 队列操作
- 字符串训练
- Junit学习笔记
- Java集合---面试题
- 震惊!慢SQL居然能优化到这种速度_我不服!
- ButterKnife使用详解
- redis队列操作
- @OneToOne
- Java集合---ArrayList的实现原理
- js2
- python读取配置文件
- 多线程之NSThread
- cdh集成kafka,spark2
- Linux笔记 程序非正常退出报错 Segmenttation fault
- Android设置Activity背景为透明style发生的错误