问题标签 [enyim.caching]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
641 浏览

c# - Memcache - 缓存数据始终为空

Memcache下面是我在控制台应用程序中的尝试。

应用程序配置

C#

每次的值为cachedDateNULL

0 投票
1 回答
172 浏览

c# - 如何在 C# 中使用 Enyim.Caching 将数据附加到 memcached?

我正在尝试使用 C# Enyim.Caching 将数据附加到 memcached 但它迫使我将数据作为 ArraySegment 发送

如何将字符串或字符串数​​组转换为 ArraySegment ?

有没有更好的方法来使用 Append?

0 投票
1 回答
162 浏览

c# - AWS C# lambda 使用 Memcached (EnyimMemcached),存储总是失败

在 AWS 中,我在私有子网中的 VPC 中设置了一个小型 memcached 节点。我的 lambda 在同一个 VPC 和私有子网中。

我的 lambda 毫无例外地运行 EnyimMemcached 代码。

当我查看 CloudWatch 时,当执行 lambda 时,我的 memcache 节点有连接,它还显示写入的字节数,但“使用的缓存项目字节数”保持为 0,并且存储命令返回“False”。

我的 Get 请求也显示在 Cloudwatch 中,因此似乎与节点存在连接。我得到的总是错过,这是有道理的,因为商店没有成功。

这就是我在测试时设置 memcache 的方式。我希望有人能指出我做错了什么,因为我一直试图解决这个问题。

谢谢

0 投票
0 回答
95 浏览

python - 使用 Memcached 将数据从 Python 传递到 C#

我在连接C#Python通过Memcached. 我在服务器上安装了 Memcached。AC# 应用程序将使用该Enyim.Caching库在 Memcached 上写入一些数据,然后 Python 应用程序将使用python-memcached(我也尝试过pymemcache)读取它pylibmc。我也想扭转这个过程并让 C# 从 Python 中读取。

我的发现是:

  1. C# 和 Python 都可以写入和读取他们自己在服务器上编写的变量。
  2. 当 C# 编写 astring时,Python 可以很好地检索它。
  3. 其他配置失败并出现以下错误:
    • C#int到 Python 的提升File "C:\Users\...\Anaconda2\envs\py37\lib\site-packages\memcache.py", line 1257, in _recv_value buf = self.decompressor(buf) error: Error -3 while decompressing data: incorrect header check"
    • C#byte到 Python 的提升ValueError: invalid literal for int() with base 10: b' '
    • Pythonstring到 C# 的提升System.ArgumentException: 'Destination array is not long enough to copy all the items in the collection. Check array index and length.'
    • Pythonint到 C# 的提升An unhandled exception of type 'System.NullReferenceException' occurred in testDatabaseC.dll Object reference not set to an instance of an object.
    • Pythonbyte到 C# 的提升System.InvalidCastException: 'Specified cast is not valid.'

字符串可以从 C# 到 Python 的事实让我认为我的代码没有任何问题。此列表中的第一个例外可能表明问题出在使用的压缩格式上。知道这个 Python 库使用zlib,但我还没有找到任何可行的替代方案。

有任何想法吗?谢谢!

下面使用了一些代码:

使用 Python 编写并使用 C# 读取(在这种情况下是 an int,但也可以是 abyte或 a string):

使用 C# 编写并使用 Python 读取:


0 投票
0 回答
30 浏览

asp.net-core - 无法使用带有 IDistributedCache 的 EnyimMemcachedCore 缓存键值

我正在尝试使用以下方法缓存“FirmDetails”的一组键:

构造函数如下所示:

与服务器相关的配置在 appsettings.developement.json 中定义如下

并在我的 Startup.cs 类的 ConfigurationService 方法中添加服务,如下所示:

现在,在尝试使用下面的代码获取“FirmDetail”的数据时,结果为空。

请让我知道我在这里做错了什么。