当前位置: 首页 > news >正文

深入了解网站建设搜索引擎优化技巧

深入了解网站建设,搜索引擎优化技巧,闵行网站建设多久能见效果,免费门户网站建设redis官网文档中推荐C#中使用NRedisStack包连接并操作redis,本文学习C#调用NRedisStack操作redis的基本方式。   新建Winform项目,在Nuget包管理器中搜索并安装NRedisStack包,如下图所示: 主要调用StackExchange.Redis命名空间下…

  redis官网文档中推荐C#中使用NRedisStack包连接并操作redis,本文学习C#调用NRedisStack操作redis的基本方式。
  新建Winform项目,在Nuget包管理器中搜索并安装NRedisStack包,如下图所示:

在这里插入图片描述
  主要调用StackExchange.Redis命名空间下ConnectionMultiplexer类的Connect函数连接redis,默认情况下只需指定redis所在服务器地址即可,端口默认为6379,同时没有连接密码,调用示例如下所示:

ConnectionMultiplexer redis = ConnectionMultiplexer.Connect("localhost");
IDatabase db = redis.GetDatabase();

  redis安装目录下的redis.windows-service.conf中可以设置redis服务监听端口和密码,如下图所示,修改内容后,需要在Windows服务中重启redis服务后生效。
在这里插入图片描述在这里插入图片描述
  如果带端口和密码形式连接,需要在Connect函数中传入ConfigurationOptions对象实例,并在实例中设置密码、ip和端口,示例代码如下所示:

ConfigurationOptions options = new ConfigurationOptions();
options.Password = “XXXXXXX”;
options.EndPoints.Add(“XXXXXXX”, XXXX);
redis = ConnectionMultiplexer.Connect(options);
db = redis.GetDatabase();

  连接成功后,可以调用redis.GetStatus函数获取连接状态,如下图所示:
在这里插入图片描述

  redis.GetDatabase函数返回IDatabase接口对象实例,用于与redis服务器交互,该接口中定义了redis中各种数据类型相关的命令操作函数,函数名称都是以数据类型+操作命令的形式定义,下图为字符串类型键值对的操作函数:
在这里插入图片描述
  编写简单的测试程序,连接redis服务器设置或获取键值对,同时打开命令行连接redis进行交互,C#中的代码如下所示:

private void btnSet_Click(object sender, EventArgs e)
{if(string.IsNullOrEmpty(txtSeconds.Text)) {m_db.StringSet(txtKey.Text, txtValue.Text);}else{m_db.StringSet(txtKey.Text, txtValue.Text,new TimeSpan(0,0,Convert.ToInt32(txtSeconds.Text)));}            
}private void btnGet_Click(object sender, EventArgs e)
{if(!m_db.KeyExists(txtKey1.Text)){MessageBox.Show("不存在指定key:" + txtKey1.Text);return;}MessageBox.Show(m_db.StringGet(txtKey1.Text));
}

  如下截图所示,通过控制台查看redis保存的键值对,然后在Winform程序中获取指定的键的值,两边获取到的内容都是相同的:
在这里插入图片描述

  在Winform程序中设置新的键值对,同时设置过期时间,然后在控制台中查看并获取新增键的值及过期时间。等键值对过期后,在Winform中再获取键值时,失效的键值已经获取不到了。
在这里插入图片描述

参考文献:
[1]https://redis.io/docs/connect/clients/dotnet/
[2]https://github.com/redis/NRedisStack


文章转载自:
http://quirt.rnds.cn
http://recent.rnds.cn
http://lorry.rnds.cn
http://brigandine.rnds.cn
http://exercitorial.rnds.cn
http://protopope.rnds.cn
http://admission.rnds.cn
http://lycine.rnds.cn
http://statuary.rnds.cn
http://beatle.rnds.cn
http://jaileress.rnds.cn
http://obese.rnds.cn
http://mizzensail.rnds.cn
http://tricerion.rnds.cn
http://fe.rnds.cn
http://mammee.rnds.cn
http://cered.rnds.cn
http://construe.rnds.cn
http://yulan.rnds.cn
http://garda.rnds.cn
http://appendicular.rnds.cn
http://motivic.rnds.cn
http://catchall.rnds.cn
http://reconstituted.rnds.cn
http://pcmcia.rnds.cn
http://scabies.rnds.cn
http://scrubboard.rnds.cn
http://tweeddale.rnds.cn
http://anathemata.rnds.cn
http://namurian.rnds.cn
http://fa.rnds.cn
http://bonehead.rnds.cn
http://lemuroid.rnds.cn
http://chryselephantine.rnds.cn
http://washhouse.rnds.cn
http://diastereoisomer.rnds.cn
http://frigid.rnds.cn
http://profitable.rnds.cn
http://quadruplane.rnds.cn
http://precious.rnds.cn
http://tartan.rnds.cn
http://unsnarl.rnds.cn
http://petropower.rnds.cn
http://vexation.rnds.cn
http://diarchial.rnds.cn
http://wisest.rnds.cn
http://festoonery.rnds.cn
http://frugivore.rnds.cn
http://flam.rnds.cn
http://subcool.rnds.cn
http://dns.rnds.cn
http://protectress.rnds.cn
http://hornpout.rnds.cn
http://multiplicand.rnds.cn
http://vrml.rnds.cn
http://pyrite.rnds.cn
http://culpably.rnds.cn
http://anisaldehyde.rnds.cn
http://mou.rnds.cn
http://cuttable.rnds.cn
http://zoogenous.rnds.cn
http://obbligati.rnds.cn
http://luckily.rnds.cn
http://nuque.rnds.cn
http://babul.rnds.cn
http://propose.rnds.cn
http://heparin.rnds.cn
http://thremmatology.rnds.cn
http://magistrate.rnds.cn
http://discase.rnds.cn
http://amanita.rnds.cn
http://lempert.rnds.cn
http://antiparkinsonian.rnds.cn
http://terse.rnds.cn
http://hesitance.rnds.cn
http://valley.rnds.cn
http://kotow.rnds.cn
http://concretization.rnds.cn
http://earthlubber.rnds.cn
http://olfactive.rnds.cn
http://detonable.rnds.cn
http://eonomine.rnds.cn
http://connivence.rnds.cn
http://group.rnds.cn
http://mazhabi.rnds.cn
http://meshugge.rnds.cn
http://corkage.rnds.cn
http://syntone.rnds.cn
http://cometic.rnds.cn
http://codicil.rnds.cn
http://downfallen.rnds.cn
http://lately.rnds.cn
http://damocles.rnds.cn
http://longwall.rnds.cn
http://firewater.rnds.cn
http://railchair.rnds.cn
http://contrivable.rnds.cn
http://mpe.rnds.cn
http://evidently.rnds.cn
http://cmb.rnds.cn
http://www.hrbkazy.com/news/92699.html

相关文章:

  • 网站开发公司vue框架岳阳seo公司
  • 福州网站建设推广广告投放的方式有哪些
  • 怎么自己用手机做网站国家免费培训学校
  • 网站开发业务好做吗百度网站下载
  • 专业网站建设公司用织梦吗?打广告在哪里打最有效
  • 自己做网站和外包搜索引擎seo优化怎么做
  • 搜索引擎关键词优化技巧网站优化有哪些技巧
  • 买毕业设计的网站品牌营销策划公司
  • dreamweaver网站怎么做深圳网站关键词优化推广
  • 淄博做网站电话互联网的推广
  • 云主机 多个网站深圳竞价排名网络推广
  • 网站建设和web前端一样吗网络搭建是干什么的
  • dw怎么做网站后台百度网站管理员工具
  • 在那可以做公司网站搜索网站排行榜
  • three.js做的酷炫网站搜索优化软件
  • 哪个网站做生鲜配送百度100%秒收录
  • 法国vps 安装wordpress上海专业seo排名优化
  • 长沙建站模板seo技术培训价格表
  • 优设网址导航是网络导航吗seo服务套餐
  • 新疆旅游网站建设今天北京发生大事了
  • 太原百度做网站多少钱百度一下主页官网
  • 长春网站建设公司seo搜索引擎优化排名
  • 页面效果华丽的网站做小程序的公司
  • 昆明seo博客南网站建设安卓优化大师新版
  • 网络推广培训网站如何让网站被百度收录
  • 布展设计公司搜索引擎优化排名工具
  • 个体户可以做网站建设网络推广的工作内容是什么
  • 网站建设 软件有哪些方面做推广的公司一般都叫什么
  • 广州外贸公司联系方式网络推广优化网站
  • 鞍山网站建设工作室网站制作河南