小编Beh*_*ooz的帖子

将Redis用作同一服务器上多个应用程序的缓存存储

我想将Redis用作同一物理机器上多个应用程序的缓存存储.

我知道至少有两种方法:

  1. 在不同的端口上运行多个Redis实例;
  2. 为不同的应用程序使用不同的Redis数据库.

但我不知道哪一个对我更好.

这些方法的优点和缺点是什么?

有没有更好的方法呢?

redis redis-server

12
推荐指数
1
解决办法
8695
查看次数

使用标准Web套接字客户端连接到Socket.io服务器

是否可以使用标准Web套接字客户端连接到socket.io服务器?通过socket.io客户端连接到socket.io服务器时,Url以HTTP启动,但对于Web套接字客户端必须使用ws.所以,如果可能,如何连接到socket.io服务器和连接到socket.io服务器的URL是什么?

websocket node.js socket.io

6
推荐指数
1
解决办法
2107
查看次数

EF代码优先,不能删除外键关系

我在这里显示了两个模型:

public class Application
{
  public string Name { get; set; }
  public virtual ICollection<ApplicationTransaction> ApplicationTransactions { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

public class ApplicationTransaction
{
  public long ApplicationId { get; set; }
  public virtual Application Application { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我试图删除所有ApplicationTransactionApplication与此代码:

var app = _repository.Get<Application>(i => i.Id == 1);
app.ApplicationTransactions.Clear();
Context.SaveChanges();
Run Code Online (Sandbox Code Playgroud)

但是当上下文保存更改时,会发生错误:

操作失败:由于一个或多个外键属性不可为空,因此无法更改该关系。对关系进行更改时,相关的外键属性将设置为空值。如果外键不支持空值,则必须定义新的关系,必须为外键属性分配另一个非空值,或者必须删除不相关的对象。

在此处输入图片说明

c# entity-framework ef-code-first

5
推荐指数
1
解决办法
6128
查看次数

缓存服务器如 Redis Vs 静态变量

我想缓存一个不超过 300 个项目的对象数组,它是只读数组。首先我用StackExchange.Redis客户端在Redis中实现,然后通过静态变量实现。与 Redis 相比,静态变量具有更好的性能和更少的 CPU 使用率,但我不知道这是不是好方法?

c# static caching stackexchange.redis

5
推荐指数
1
解决办法
1910
查看次数

OpenXml和Unable无法创建互斥锁

我试图通过openXml lib创建Excel文档,但是当我想从大量数据创建Excel时,我无法创建互斥锁.(来自HRESULT的异常:0x80131464)错误,堆栈跟踪是:

[IsolatedStorageException: Unable to create mutex. (Exception from HRESULT: 0x80131464)]
   System.IO.IsolatedStorage.IsolatedStorageFile.Open(String infoFile, String syncName) +0
   System.IO.IsolatedStorage.IsolatedStorageFile.Lock(Boolean& locked) +370
   System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf) +468
   System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf) +35
   MS.Internal.IO.Packaging.SafeIsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, ReliableIsolatedStorageFileFolder folder) +102
   MS.Internal.IO.Packaging.PackagingUtilities.CreateUserScopedIsolatedStorageFileStreamWithRandomName(Int32 retryCount, String& fileName) +276
   MS.Internal.IO.Packaging.SparseMemoryStream.EnsureIsolatedStoreStream() +31
   MS.Internal.IO.Packaging.SparseMemoryStream.SwitchModeIfNecessary() +400
   MS.Internal.IO.Packaging.CompressEmulationStream.Write(Byte[] buffer, Int32 offset, Int32 count) +76
   MS.Internal.IO.Packaging.CompressStream.Write(Byte[] buffer, Int32 offset, Int32 count) +431
   MS.Internal.IO.Zip.ProgressiveCrcCalculatingStream.Write(Byte[] …
Run Code Online (Sandbox Code Playgroud)

.net c# excel ms-office openxml

3
推荐指数
2
解决办法
8317
查看次数