【NoSql】Redis
【NoSql】Redis
一. 文档
1. 官网
2. Windows 安装包
3. C# Driver
a. ServiceStack.Redis 最新版本是收费的
二. 命令
1. 启动Redis : redis-server.exe redis.conf,以配置文件的方式启动
三. C# 代码,封装了一些常用的函数
public class RedisHelper
{
#region Property private ConnectionMultiplexer _client; private IDatabase _db; public string Host { get; set; } public int Port { get; set; } #endregion #region Construction public RedisHelper()
{
Host = "127.0.0.1";
Port = 6379;
} public RedisHelper(string host, int port)
{
Host = host;
Port = port;
} #endregion #region PubliceFunction public bool Connect()
{
_client = ConnectionMultiplexer.Connect(Host + ":" + Port);
_db = _client.GetDatabase();
return true;
} public bool Add(string key, string t)
{
return _db.StringSet(key, t);
} public bool Add<T>(string key, T t) where T : class
{
return _db.StringSet(key, t.ToJson());
} public bool Delete(string key)
{
return _db.KeyDelete(key);
} public bool ContainsKey(string key)
{
return _db.KeyExists(key);
} public string Get(string key)
{
return _db.StringGet(key);
} public T Get<T>(string key) where T : class
{
var r = _db.StringGet(key).ToString();
if (r.IsEmpty()) return null;
return r.ToEntity<T>();
} #endregion
}
【NoSql】Redis的更多相关文章
- 【NoSql】Redis实践篇-简单demo实现(一)
Redis是一个key-value存储系统. Redis的出现,非常大程度补偿了memcached这类key/value存储的不足,在部分场合能够对关系数据库起到非常好的补充作用 Redis是一个ke ...
- 【NoSql】MongoDb
[NoSql]MongoDb 一. 文档 1. 官网 2. C# Driver 3. C# 开发文档 二. 命令 1. --config "C:\mongodb\mongod.cfg&quo ...
- 【python】redis基本命令和基本用法详解
[python]redis基本命令和基本用法详解 来自http://www.cnblogs.com/wangtp/p/5636872.html 1.redis连接 redis-py提供两个类Redis ...
- 【转】Redis学习---NoSQL和SQL的区别及使用场景
什么是NoSQL NoSQL,指的是非关系型的数据库.NoSQL有时也称作Not Only SQL的缩写,是对不同于传统的关系型数据库的数据库管理系统的统称,它具有非关系型.分布式.不提供ACID的数 ...
- 亿级流量场景下,大型缓存架构设计实现【1】---redis篇
*****************开篇介绍**************** -------------------------------------------------------------- ...
- 【转】Redis学习---哈希结构内存模型剖析
[原文]https://www.toutiao.com/i6594624365906625032/ 概述 在前文<Redis字符串类型内部编码剖析>之中已经剖析过 Redis最基本的 St ...
- 【转】Redis学习---阿里云Redis多线程性能增强版详解
[原文]https://www.toutiao.com/i6594620107123589635/ 摘要 Redis做为高性能的K-V数据库,由于其高性能,丰富的数据结构支持,易用等特性,而得到广泛的 ...
- 【转】redis数据库入门教程(全面详细)+面试问题
[本教程目录] 1.redis是什么2.redis的作者何许人也3.谁在使用redis4.学会安装redis5.学会启动redis6.使用redis客户端7.redis数据结构 – 简介8.redis ...
- 【转载】redis优化配置和redis.conf说明
转载地址:http://blog.csdn.net/luozhonghua2014/article/details/40568707?utm_source=tuicool&utm_medium ...
随机推荐
- EF 分组查询
var result = from m in userPrefers.GroupBy(t => new { t.Pet_Preferential.Merchant.MerchantId, t.P ...
- [DFNews] Blackbag发布MacQuisition 2013 R2
New in MacQuisition 2013 R2: Improved FileVault 2 Detection - Automatically detect the presence of a ...
- php和js如何通过json互相传递数据
当我们在结合php和javascript实现某些功能时,经常会用到json.json是js的一种数据格式,可以直接被js解析.而php无法直接读取json数据,但是php提供了json_decode函 ...
- mac-文本编辑器
windows时代最喜欢的文本编辑器一直是ultraedit,但到了mac下,破解的ultraedit退出时会异常,于是琢磨着换编辑器,最终选择了sublime text2,百度下载,不注册也可以用. ...
- SQL Server performance tips
Refer to: http://harriyott.com/2006/01/sql-server-performance-tips A colleague of mine has been look ...
- 4、IMS
链:1:http://www.cnblogs.com/gnuhpc/archive/2012/12/11/2813494.html [笔记] 1.<计算机网络(第五版)>P10-15:电路 ...
- reverse engineering in ax
install Visio2010 Premium(UML model template). not work in Visio 2013 and other version.
- CentOS 7部署OpenStack(二)—安装keystone服务
1.创建数据库 [root@controller ~]# mysql -u root -p [root@controller ~]# CREATE DATABASE keystone; [root@c ...
- 【MySQL】 GTID使用
参考:http://hcymysql.blog.51cto.com/5223301/1579197 参考:http://blog.itpub.net/29733787/viewspace-146255 ...
- ubuntu 'Unable to correct problems, you have held broken packages' 错误
在用apt 安装软件时,有时会用国内的源以加快下载速度. 但是在使用ubuntu 14.04的过程中,这一过程可能会导致错误“Unable to correct problems, you have ...