码迷,mamicode.com
首页 > 其他好文 > 详细

redis哈希缓存数据表

时间:2019-03-03 20:58:49      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:读取   sha   ble   lines   har   ash   表数   写入   highlight   

redis哈希缓存数据表

REDIS HASH可以用来缓存数据表的数据,以后可以从REDIS内存数据库中读取数据。

从内存中取数,无疑是很快的。

1)将数据表中的数据写入REDIS缓存

  Redis.cmd_HSET(‘table1‘, ‘field1‘, ‘1‘);
  Redis.cmd_HSET(‘table1‘, ‘field2‘, ‘2‘);

  2)从REDIS获取缓存的数据表数据

procedure TForm1.Button2Click(Sender: TObject);
var
  s, s2: string;
begin
  Redis.cmd_HGET(‘table1‘, ‘field1‘, s);
  Redis.cmd_HGET(‘table1‘, ‘field2‘, s2);
  Memo1.Lines.Add(‘field1 ‘ + s);
  Memo1.Lines.Add(‘field2 ‘ + s2);
end;

  

redis哈希缓存数据表

标签:读取   sha   ble   lines   har   ash   表数   写入   highlight   

原文地址:https://www.cnblogs.com/hnxxcxg/p/10467271.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!