1 changed files with 59 additions and 59 deletions
@ -1,60 +1,60 @@
|
||||
package org.springblade.auth; |
||||
|
||||
import com.alibaba.fastjson.JSONObject; |
||||
import io.protostuff.LinkedBuffer; |
||||
import io.protostuff.ProtobufIOUtil; |
||||
import io.protostuff.Schema; |
||||
import io.protostuff.runtime.RuntimeSchema; |
||||
import org.junit.jupiter.api.Test; |
||||
import org.junit.jupiter.api.extension.ExtendWith; |
||||
import org.springblade.common.cache.CacheNames; |
||||
import org.springblade.core.cache.utils.CacheUtil; |
||||
import org.springblade.core.redis.cache.BladeRedis; |
||||
import org.springblade.core.test.BladeBootTest; |
||||
import org.springblade.core.test.BladeSpringExtension; |
||||
import org.springblade.core.tool.utils.ProtostuffUtil; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.data.redis.core.RedisTemplate; |
||||
|
||||
import java.io.ByteArrayInputStream; |
||||
import java.io.IOException; |
||||
import java.io.UnsupportedEncodingException; |
||||
|
||||
@ExtendWith(BladeSpringExtension.class) |
||||
@BladeBootTest(appName = "blade-auth", enableLoader = true) |
||||
public class TestService { |
||||
|
||||
@Autowired |
||||
private BladeRedis bladeRedis; |
||||
|
||||
|
||||
@Test |
||||
public void test2() { |
||||
RedisTemplate<String, Object> redisTemplate = bladeRedis.getRedisTemplate(); |
||||
// byte[] dump = redisTemplate.dump("627683:logpm:user:warehouse:select:1649331096967450625");
|
||||
// Schema<String> schema = RuntimeSchema.getSchema(String.class);
|
||||
// LinkedBuffer buffer = LinkedBuffer.allocate(256);
|
||||
// String s = schema.newMessage();
|
||||
// ProtobufIOUtil.mergeFrom(new ByteArrayInputStream(dump), s, schema, buffer);
|
||||
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// jsonObject.put("name","xiaob");
|
||||
// jsonObject.put("age",23);
|
||||
|
||||
// bladeRedis.setEx(CacheNames.tenantKeyObj("627683", CacheNames.USER_WAREHOUSE_KEY, "1649331096967450625"), jsonObject.toJSONString(), 30 * 24 * 60 * 60L);
|
||||
// bladeRedis.setEx(CacheNames.tenantKeyObj("627683111", CacheNames.USER_WAREHOUSE_KEY, "1649331096967450625"), ProtostuffUtil.serialize(jsonObject.toJSONString()), 30 * 24 * 60 * 60L);
|
||||
|
||||
//package org.springblade.auth;
|
||||
//
|
||||
//import com.alibaba.fastjson.JSONObject;
|
||||
//import io.protostuff.LinkedBuffer;
|
||||
//import io.protostuff.ProtobufIOUtil;
|
||||
//import io.protostuff.Schema;
|
||||
//import io.protostuff.runtime.RuntimeSchema;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
//import org.junit.jupiter.api.extension.ExtendWith;
|
||||
//import org.springblade.common.cache.CacheNames;
|
||||
//import org.springblade.core.cache.utils.CacheUtil;
|
||||
//import org.springblade.core.redis.cache.BladeRedis;
|
||||
//import org.springblade.core.test.BladeBootTest;
|
||||
//import org.springblade.core.test.BladeSpringExtension;
|
||||
//import org.springblade.core.tool.utils.ProtostuffUtil;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.data.redis.core.RedisTemplate;
|
||||
//
|
||||
//import java.io.ByteArrayInputStream;
|
||||
//import java.io.IOException;
|
||||
//import java.io.UnsupportedEncodingException;
|
||||
//
|
||||
//@ExtendWith(BladeSpringExtension.class)
|
||||
//@BladeBootTest(appName = "blade-auth", enableLoader = true)
|
||||
//public class TestService {
|
||||
//
|
||||
// @Autowired
|
||||
// private BladeRedis bladeRedis;
|
||||
//
|
||||
//
|
||||
// @Test
|
||||
// public void test2() {
|
||||
// RedisTemplate<String, Object> redisTemplate = bladeRedis.getRedisTemplate();
|
||||
//// byte[] dump = redisTemplate.dump("627683:logpm:user:warehouse:select:1649331096967450625");
|
||||
//// Schema<String> schema = RuntimeSchema.getSchema(String.class);
|
||||
//// LinkedBuffer buffer = LinkedBuffer.allocate(256);
|
||||
//// String s = schema.newMessage();
|
||||
//// ProtobufIOUtil.mergeFrom(new ByteArrayInputStream(dump), s, schema, buffer);
|
||||
//
|
||||
//// JSONObject jsonObject = new JSONObject();
|
||||
//// jsonObject.put("name","xiaob");
|
||||
//// jsonObject.put("age",23);
|
||||
//
|
||||
//// bladeRedis.setEx(CacheNames.tenantKeyObj("627683", CacheNames.USER_WAREHOUSE_KEY, "1649331096967450625"), jsonObject.toJSONString(), 30 * 24 * 60 * 60L);
|
||||
//// bladeRedis.setEx(CacheNames.tenantKeyObj("627683111", CacheNames.USER_WAREHOUSE_KEY, "1649331096967450625"), ProtostuffUtil.serialize(jsonObject.toJSONString()), 30 * 24 * 60 * 60L);
|
||||
//
|
||||
//// Object o = bladeRedis.get("627683:logpm:user:warehouse:select:1649331096967450625");
|
||||
//
|
||||
//// byte[] dump = redisTemplate.dump("627683:logpm:user:warehouse:select:1649331096967450625");
|
||||
//
|
||||
// Object o = bladeRedis.get("627683:logpm:user:warehouse:select:1649331096967450625");
|
||||
|
||||
// byte[] dump = redisTemplate.dump("627683:logpm:user:warehouse:select:1649331096967450625");
|
||||
|
||||
Object o = bladeRedis.get("627683:logpm:user:warehouse:select:1649331096967450625"); |
||||
// Object o = bladeRedis.get("627683111:logpm:user:warehouse:select:1649331096967450625");
|
||||
|
||||
// String deserialize = ProtostuffUtil.deserialize(dump, String.class);
|
||||
|
||||
System.out.println(111); |
||||
|
||||
} |
||||
|
||||
} |
||||
//// Object o = bladeRedis.get("627683111:logpm:user:warehouse:select:1649331096967450625");
|
||||
//
|
||||
//// String deserialize = ProtostuffUtil.deserialize(dump, String.class);
|
||||
//
|
||||
// System.out.println(111);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
Loading…
Reference in new issue