RedisRepComponent.java 702 B

1234567891011121314151617181920212223242526272829
  1. package com.hb.proj.gather.rep;
  2. import java.util.Map;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.data.redis.core.HashOperations;
  5. import org.springframework.data.redis.core.RedisTemplate;
  6. import org.springframework.stereotype.Component;
  7. /**
  8. * 采集数据在redis中的持久化
  9. * @author cwen
  10. *
  11. */
  12. @Component
  13. public class RedisRepComponent {
  14. @Autowired
  15. private RedisTemplate<String,String> redisTemplate;
  16. /**
  17. * 实时数据入redis
  18. * @param wellId
  19. * @param datas
  20. */
  21. public void put(String wellId,Map<String,String> datas) {
  22. HashOperations<String, String, String> ops=redisTemplate.opsForHash();
  23. ops.putAll(wellId, datas);
  24. }
  25. }