@Repository
public class RedisServiceExtend {
@Autowired
private RedisTemplate<String, String> redisTemplate; private static String redisCode = "utf-8"; public long bitCount(final String key) {
return redisTemplate.exec((RedisCallback<Long>) con -> con.bitCount(key.getBytes()));
} public Long bitCount(String key, int start, int end) {
return redisTemplate.execute((RedisCallback<Long>) con -> con.bitCount(key.getBytes(), start, end));
} public Long bitOp(RedisStringCommands.BitOperation op, String saveKey, String... desKey) {
byte[][] bytes = new byte[desKey.length][];
for (int i = 0; i < desKey.length; i++) {
bytes[i] = desKey[i].getBytes();
}
return redisTemplate.execute((RedisCallback<Long>) con -> con.bitOp(op, saveKey.getBytes(), bytes));
} }

redisTemplate 封装bitcout的更多相关文章

  1. Spring-data-redis操作redis知识汇总

    什么是spring-data-redis spring-data-redis是spring-data模块的一部分,专门用来支持在spring管理项目对redis的操作,使用java操作redis最常用 ...

  2. Spring Boot 整合 Redis 实现缓存操作

    摘要: 原创出处 www.bysocket.com 「泥瓦匠BYSocket 」欢迎转载,保留摘要,谢谢!   『 产品没有价值,开发团队再优秀也无济于事 – <启示录> 』   本文提纲 ...

  3. Jedis连接池使用

    构建redis连接池,返还到连接池 private static JedisPool jedisPool = null; private static Jedis jedis; static { je ...

  4. redis资源未释放引发的问题

    一.redis资源未释放的起因: N年前,在修改一个古老程序时,不小心把redis释放的这块给干掉了, if (jedis != null) { if (!isInProcess) { jedis.d ...

  5. 补习系列(14)-springboot redis 整合-数据读写

    目录 一.简介 二.SpringBoot Redis 读写 A. 引入 spring-data-redis B. 序列化 C. 读写样例 三.方法级缓存 四.连接池 小结 一.简介 在 补习系列(A3 ...

  6. Spring-data-redis操作redis知识总结

    什么是spring-data-redis spring-data-redis是spring-data模块的一部分,专门用来支持在spring管理项目对redis的操作,使用java操作redis最常用 ...

  7. Spring Boot + Mybatis + Redis二级缓存开发指南

    Spring Boot + Mybatis + Redis二级缓存开发指南 背景 Spring-Boot因其提供了各种开箱即用的插件,使得它成为了当今最为主流的Java Web开发框架之一.Mybat ...

  8. redis 在java中的使用

    1.首先下载jar包放到你的工程中 2.练习 package com.jianyuan.redisTest; import java.util.Iterator;import java.util.Li ...

  9. spring boot redis缓存入门

    摘要: 原创出处 泥瓦匠BYSocket 下载工程 springboot-learning-example ,工程代码注解很详细.JeffLi1993/springboot-learning-exam ...

随机推荐

  1. 【HDOJ6695】Welcome Party(multiset)

    题意: n<=1e5,x[i],y[i]<=1e18 思路: #include<bits/stdc++.h> using namespace std; typedef long ...

  2. 循序渐进实现仿QQ界面(一):园角矩形与双缓冲贴图窗口

    印象里仿QQ界面的程序应该有很多,搜了一下,虽然出来一大堆,排除了重复的,却只有两三个,没我想象的好.经常看到CSDN上有人问,QQ这个功能怎么实现,那个界面怎么实现,归纳了一下,决定写这么一个仿QQ ...

  3. Vue-数据绑定原理

    VueJS 使用 ES5 提供的 Object.defineProperty() 方法实现数据绑定. 感觉实现时主要是在 defineProperty 的 set 和 get 上做了很多文章,在 ge ...

  4. 实验吧 Web的WriteUp

    每次看别人的Writeup都有一种感觉,为什么有了WriteUp我还是不会,每次都打击自己的积极性,所以自己尝试写一篇每个萌新都能看懂的Writeup. 0x01 天下武功唯快不破 题目提示 : 看看 ...

  5. python web自动化测试框架搭建(功能&接口)——接口用例实现

    测试用例基类: # coding=utf-8 import unittest import Logger log = Logger.Loger() class BaseCase(unittest.Te ...

  6. upc组队赛16 Winner Winner【位运算】

    Winner Winner 题目链接 题目描述 The FZU Code Carnival is a programming competetion hosted by the ACM-ICPC Tr ...

  7. 应用安全-工具使用-Burpsuite

    A cheat sheet for PortSwigger Burp Suite application security testing framework. Send to Repeater Ct ...

  8. Win7 VSCode 在线安装Rust语言及环境配置

    睡前彻底解决在VSCode中,按F12不跳转到标准库源码的问题. 首先,如果装过离线版,卸载掉. 然后去官网下载 rustup-init.exe https://www.rust-lang.org/t ...

  9. CNN之池化层tf.nn.max_pool | tf.nn.avg_pool | tf.reduce_mean | padding的规则解释

    摘要:池化层的主要目的是降维,通过滤波器映射区域内取最大值.平均值等操作. 均值池化:tf.nn.avg_pool(input,ksize,strides,padding) 最大池化:tf.nn.ma ...

  10. JSP基础--九大内置对象

    JSP九大内置对象 Object findAttribute(String name):依次在page.request.session.application范围查找名称为name的数据,如果找到就停 ...