天道酬勤,学无止境

redis

在 JSON 字符串反序列化期间处理名称空间更改(handling name space changes during deserialization of JSON String)

问题 我有 2 个应用程序在 redis 服务器的帮助下相互通信,在我的第一个应用程序中,我能够序列化和反序列化以下类型的对象 { "$type": "System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib], [OPCMessagingService.Resource, OPCMessagingService]], mscorlib", "71": { "$type": "OPCMessagingService.Resource, OPCMessagingService", "SiteID": 2, "ResourceID": 71, "ProcessOrder": "001000380873", "CurrentStatus": 0, "CycleTime": 55, "DeviceList": [ { "$type": "OPCMessagingService.StackLight, OPCMessagingService", "ResourceId": 71, "DeviceIp": "10.142.117.7", "ComPort": "COM14" }, { "$type": "OPCMessagingService.LED, OPCMessagingService", "ResourceId"

2021-06-21 12:11:17    分类:技术分享    c#   json   redis   json.net   deserialization

How do I compile Redis so that I can upload and run it on shared hosting?

I need to run Redis on my shared hosting account, but I am unable to compile on the server because of the nature of shared hosting. I have SSH access, but my hosting provider told me that I would need to compile Redis first and then upload it to the server. I'm not sure how to go about this, and the only other person that asked this question on here never got a response. So: how do I compile Redis so that I can upload it to and run it on my shared hosting account?

2021-06-21 11:17:19    分类:问答    linux   compilation   redis   shared-hosting

Will Redis maxmemory-policy volatile-lru evict if nothing is past expired date?

I've a redis server set with a maxmemory-policy set to volatile-lru. The documentation indicate this will evict from the set of entries with expires set when memory limit has reached. In this case, does redis only evict items past their expiration? If everything in memory has an expire set, but nothing is past the expiration time, will anything get evicted when max memory is reached?

2021-06-21 10:33:31    分类:问答    caching   redis   amazon-elasticache

Redis 发布订阅和消息队列(Redis Pubsub and Message Queueing)

问题 我的总体问题是:将 Redis 用于 PubSub,当发布者将消息推送到频道的速度比订阅者能够读取它们的速度快时,消息会发生什么? 例如,假设我有: 一个简单的发布者以 2 msg/sec 的速率发布消息。 一个简单的订阅者以 1 msg/sec 的速率阅读消息。 我天真的假设订阅者只会看到 50% 的消息发布到 Redis 上。 为了测试这个理论,我写了两个脚本: 发布文件 queue = redis.StrictRedis(host='localhost', port=6379, db=0) channel = queue.pubsub() for i in range(10): queue.publish("test", i) time.sleep(0.5) 子.py r = redis.StrictRedis(host='localhost', port=6379, db=0) p = r.pubsub() p.subscribe('test') while True: message = p.get_message() if message: print "Subscriber: %s" % message['data'] time.sleep(1) 结果 当我先运行sub.py ,紧接着是pub.py ,我发现sub.py实际上显示了所有消息(1-10)

2021-06-21 10:18:50    分类:技术分享    python   redis   redis-cli

在 aws 微型实例上安装 redis(install redis on aws micro instance)

问题 我需要在亚马逊云中安装redis。 我需要它作为我的 npm 模块 kue(部署)的一部分。 考虑到我对 linux 和管理并不好到坏,任何人都可以将我一步一步的教程链接起来或解释如何做。 回答1 与其启动 EC2 实例并在那里安装/管理 redis,您还可以创建一个运行 redis 的 Elasticache 实例,并让 AWS 为您管理这一切。 如果您确实想运行自己的 redis 服务器,那么您需要启动一个 EC2 实例,然后手动将 redis 安装到它上面。 我链接到的 AWS 和 redis 文档都提供了分步说明。 回答2 如果您启用 Amazon Linux 上的 Extra Packages for Enterprise Linux (EPEL) 存储库,则可以使用 yum 进行安装。 sudo yum-config-manager --enable epel sudo yum install redis # Start redis server sudo redis-server /etc/redis.conf 回答3 这在我的“Amazon Linux 2”操作系统(基于 RHEL/CENTOS 7)上对我有用 wget -O /tmp/epel.rpm –nv https://dl.fedoraproject.org/pub/epel/epel

2021-06-21 10:00:59    分类:技术分享    amazon-web-services   redis   aws-cli

如何自动装配 RedisTemplate(How autowired RedisTemplate<String,Long>)

问题 我想在春季启动时使用 RedisTemplate。 我可以成功使用 StringRedeisTemplate ,但是当我不能使用 RedisTemplate 时。 这是代码。 @Service public class MyService { @Autowired private RedisTemplate<String, Long> template; public void execute() { template.opsForValue().set("hoge", 1l); } } 但是,当启动应用程序时,会出错。 > Exception in thread "main" > org.springframework.beans.factory.BeanCreationException: Error > creating bean with name 'MyService': Injection of autowired > dependencies failed; nested exception is > org.springframework.beans.factory.BeanCreationException: Could not > autowire field: private > org.springframework.data.redis.core

2021-06-21 09:14:23    分类:技术分享    java   spring   spring-mvc   redis

How to store spring security session information in redis?

I am using Spring security for Authentication and Authorization in my application. I am using Neo4j database as backend and implemented userDetailsService for authentication. However, whenever my application restarts, user is forced to login once again. To overcome this, i am thinking to store session information in redis database and load the data to Spring security Context whenever application gets started. Kindly pass on if there are any articles and pointers to implement the same. I am thinking of following implementation for it, 1) For every successful authentication, store user details

2021-06-15 15:26:22    分类:问答    spring-security   redis   session-management

Redis: Implement Weighted Directed Graph

What's the best way to implement weighted graph using Redis? We will mostly search for shortest paths over the graph (probably using the Dijkstra algorithm) Currently we considered adding the edges to Redis For each node, we will have the nodeId as the key and a sortedset of keys of referenced nodes the score of each nodeId in the sortedSet is the weight of the edge. What do you think? Correct me if I am wrong but the only bummer here is that for each query for the next node in a sortedset we pay O(logn) instead of O(1)... http://redis.io/commands/zrange

2021-06-15 12:02:15    分类:问答    graph   redis   graph-theory   sortedset

Difference between storing Integers and Strings in Redis

Any difference between these two commands? LPUSH myset 123 LPUSH myset "123" I want to store about 5 million integers and I want to do it in the most efficient way.

2021-06-15 10:19:18    分类:问答    redis

SignalR cannot connect to Azure Redis on SSL

I am currently hosting my redis cache server on Azure, and have signalR relying on it as the backbone using the following... GlobalHost.DependencyResolver.UseRedis("Server",port,"password","eventKey"); This works find on port 6379 (non-SSL) but my chat app breaks when I try to connect to the SSL port (6380) of my Azure Redis server, and the hub is never started. What could be the cause of this issue? Or am I doing something wrong? This is the error that appears on /signalr/connect in my browser net::ERR_CONNECTION_RESET

2021-06-15 07:45:19    分类:问答    redis   signalr   signalr-hub   signalr-backplane   azure-redis-cache