时隔半个月,终于又能上网了,连接到e时代的感觉真是非凡
这几天找了几份面试发现.net的技术更新比起其他语言还是慢很多,比如hadoop集群啦 ,gulp/webpack啦,socketio啦,electron啦,react啦,Impala啦,nosql啦,再就是这个好用的redis
抽空要把上面的都学习了解并且写点像样的东西出来,不是以前那种糊弄自己的blog了(反正空间有的是,闲着也是浪费哈)
直接从项目开始

新建mvc项目

nuget包管理里面下载最方便,如果不喜欢可以去github上fork

第一个是redis服务端的所有文件,直接下载就行
由于redis是c实现的,并不支持c#直接访问和通信,所以需要一个hub一样的东西当中介,就是下面两个(任选其一)
安装后会显示在引用里面

到这个目录找一下redis的服务端文件,windows直接运行linux另算

服务启动之后呢,会显示端口和一些基础信息,这些启动的参数可以在配置文件里改

有了服务,开始写缓存的代码,来个基础的,客户端存进去(是支持好几种数据类型的,但是我没记住,给忘了)

运行项目,执行存缓存的代码,然后找到文件夹的客户端程序(其实有更好用的GUI查看工具,但是我的网很差,下载不到)

get一下就能查到了,save一下就能把内存中的数据DUMP到本地文件

就这样,你的mvc项目初步拥有了内存级别的缓存功能,性能可以媲美memcache
有时间的话,再来做更深入的研究吧