RedisHelper.cs 704 B

123456789101112131415161718192021222324252627282930
  1. using ServiceStack.Redis;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace ToolsClassLibrary
  8. {
  9. public class RedisHelper
  10. {
  11. static RedisClient rc;
  12. public RedisHelper(string _ip, int _port, string _pwd, int _db)
  13. {
  14. if (rc == null)
  15. {
  16. rc = new RedisClient(_ip, _port, _pwd, _db);
  17. }
  18. }
  19. public List<string> GetRedisKeys()
  20. {
  21. return rc.GetAllKeys();
  22. }
  23. public IDictionary<string,double> GetRedisKeys(List<string> points)
  24. {
  25. return rc.GetAll<double>(points);
  26. }
  27. }
  28. }