cnblogs / enyimmemcachedcore Goto Github PK
View Code? Open in Web Editor NEWThis project forked from enyim/enyimmemcached
.NET Memcached client. Available on https://www.nuget.org/packages/EnyimMemcachedCore
License: Apache License 2.0
This project forked from enyim/enyimmemcached
.NET Memcached client. Available on https://www.nuget.org/packages/EnyimMemcachedCore
License: Apache License 2.0
If you are using a hostname to connect to memcache such as myelasticcache.number.usw2.cache.amazonaws.com, this results in the host name being used to generate keys to lookup servers with. Classic enyim resolves the host name and then uses the IP address. Because of this difference, this version will choose different nodes for getting / setting memcache values. If you are using both dotnetcore and enyim in the same environment e.g. your main web servers run on windows in IIS and you do background work in AWS Lambda, this difference causes major problems.
In this version of IMemcachedNode.cs a System.Net.EndPoint is used while in the regular version of Enyim it is a System.Net.IPEndPoint.
What was the reason for not using an IPEndPoint like regular Enyim? Why was this change made? 6b78cf5
I want use this to store data in multi server,but always just store in one
is that need some code to config?
I just add a config in appsettings.json
"Memcached": {
"Servers": [
{
"Address": "39.108.125.154",
"Port": 11211
},
{
"Address": "39.108.125.154",
"Port": 11210
}
]
}
}
At the moment, the implementation and all the examples are geared toward injecting Memcached into middleware and its usage as DI.
But imagine the following project structure. Widget.UI project (MVC) calls Widget.Business calls Widget.Services calls Widget.Repository. Let's say I want to implement distributed caching in Widget.Repository (last project in the chain). I'd have to build constructors to accept Memcached client from Widget.Business all the way down to Widget.Repository.
This would make usage of the intermediate projects from other places in code difficult to say the least.
I understand that I can create a Memcached instance via GenericHost approach. I don't think that's a good way to go because I am building out an entire host infrastructure in a class that doesn't know anything about that.
Please provide a constructor to enable something similar to the following:
var options = new MemcachedOptions {.Servers = "11.22.33.44"};
var cache = new MemcachedClient(options);
Missing KeyTransfrom inside PerformStore / PerformStoreAsync methods
Is there anyway to do a touch with the library as-is? I want to extend the duration of a key's existence without replacing it entirely if possible.
Read operation returns result object that be marked as failed or null when it fails.
But write operation throws System.Exception
in same situation.
imo, it should throws System.IO.IOException
instead of Exception
so that MemcachedNode may catch it.
运行环境
Core版本
EnyimMemcachedCore版本
错误日志
2018-12-27 01:01:00.927 +08:00 [Error] GetAsync("test-cachekey")
System.ArgumentOutOfRangeException: Unexpected BsonType value: 0
Parameter name: type
at Newtonsoft.Json.Bson.BsonDataReader.ReadType(BsonType type)
at Newtonsoft.Json.Bson.BsonDataReader.ReadNormal()
at Newtonsoft.Json.Bson.BsonDataReader.Read()
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
at Enyim.Caching.Memcached.DefaultTranscoder.Deserialize[T](CacheItem item)
at Enyim.Caching.MemcachedClient.BuildGetCommandResult[T](IGetOperationResult`1 result, IGetOperation command, IOperationResult commandResult)
at Enyim.Caching.MemcachedClient.GetAsync[T](String key)
fail: Enyim.Caching.Configuration.MemcachedClientConfiguration[24311045]
Create PooledSocket
System.TimeoutException: Could not connect to Unspecified/memcached:11211
at Enyim.Caching.Memcached.PooledSocket.ConnectWithTimeout(Socket socket, EndPoint endpoint, Int32 timeout)
at Enyim.Caching.Memcached.PooledSocket..ctor(EndPoint endpoint, TimeSpan connectionTimeout, TimeSpan receiveTimeout, ILogger logger)
at Enyim.Caching.Memcached.MemcachedNode.CreateSocket()
fail: Enyim.Caching.Configuration.MemcachedClientConfiguration[0]
Could not init pool.
warn: Enyim.Caching.Configuration.MemcachedClientConfiguration[0]
Marking node Unspecified/memcached:11211 as dead
EnyimMemcached Started.
Hosting environment: Development
Currently, EnyimMemcachedCore has the default implementation of IDistributedCache
in MemcachedClient
.
Maybe we can move the implementation of IDistributedCache
to another project as an extension of EnyimMemcachedCore .
How to reproduce?
just run test case:
Test Name: MemcachedTest.BinaryMemcachedClientTest.StoreStringTest
Test FullName: MemcachedTest.BinaryMemcachedClientTest.StoreStringTest
can i config the keepalive options to the memcached server
` //it can be cached ,when set cache with expire time setted by 0
var key1Value= _memcachedClient.Get("key1");
if (key1Value == null)
{
_memcachedClient.Add("key1", "dadaxia", 0);
}
//but when setted by expire time, it can not be cached successfull
_memcachedClient.Add("key1", "dadaxia", 600);`
Hello,
There's a missing method exception when using EnyimMemcachedCore together with 2.0.0-preview2-final:
System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task`1<Byte[]> Microsoft.Extensions.Caching.Distributed.IDistributedCache.GetAsync(System.String)'.
Any chance this could be fixed?
I am not able to select the minpoolsize and maxpoolsize configuration from appsettings.json file.
I am always getting the default value.
Please help anyone?
Maybe we should remove some stale branches to keep this repository clean
GetValueAsync<>
always failed with unable to locate node with key
under high concurrency.
A simple reproduce: https://github.com/ZeekoZhu/memcachedcore-stress
Here is the output on my computer:
Use GetValueAsync
Single Run: 1/1/01 8:05:00 AM
Single Run: 1/1/01 8:05:00 AM
Time: 21458ms
Error Cnt: 999988
Avg: 0.021458ms
Use Get
Single Run: 1/1/01 8:05:00 AM
Single Run: 1/1/01 8:05:00 AM
Time: 25200ms
Error Cnt: 0
Avg: 0.0252ms
Get<>
is much more reliable than GetValueAsync<>
Upon upgrading to the latest release, 1.1.0 I am getting an exception when initializing memcached and adding a server. This code has been working without issue and the only change I made was updating this package. Here is the code to setup Memcached which is causing the problem:
var memcachedClientLogger = _loggerFactory.CreateLogger<MemcachedClient>();
var options = Options.Create(new MemcachedClientOptions());
var config = new MemcachedClientConfiguration(memcachedClientLogger, options);
foreach (var node in CacheNodes)
{
Logger.Debug("Adding memcache server node {0}:{1} to configuration", node.Endpoint.Address,
node.Endpoint.Port);
config.AddServer(node.Endpoint.Address, node.Endpoint.Port); //Line 83 in the stacktrace below
}
I get NRE with this stack trace:
System.NullReferenceException: Object reference not set to an instance of an object. at Enyim.Caching.Configuration.ConfigurationHelper.ResolveToEndPoint(String host, Int32 port) at Enyim.Caching.Configuration.MemcachedClientConfiguration.AddServer(String host, Int32 port) at Foo.AWS.ElastiCache.ElastiCacheService.d__8.MoveNext() in /src/Foo.AWS/ElastiCache/ElasticCacheService.cs:line 83 --- End of stack trace from previous location where exception was thrown --- .....
The logged message before calling AddServer is:
Adding memcache server node XXXXXX.uiezb6.0001.use1.cache.amazonaws.com:11211 to configuration
This appears to be related to commit dc5cf83, which was the most recent change prior to releasing 1.1.0.
Glad to see this port but the tests and examples should be updated to reflect changes that have been made.
When I want to use FlushAllAsync in my code, this api should work in version 2.1.0.6 but I can not find this api via VS!
I use Go To Definition to see the interface IMemcachedClient
, I also can not find out this api as well!
And I notice the summary which makes me confuse here!
Is there something wrong about version 2.1.0.6 ?
只能通过core mvc的依赖注入使用?我在普通类库怎么使用?
This is a great library you have put together. I ran into one minor issue blow, which is that you have to misspell Addess
to get it to work.
{
"enyimMemcached": {
"Servers": [
{
"Addess": "memcached",
"Port": 11211
}
]
}
}
BSON does not support unsigned types, if the number larger than signed type max value, it throws exception:
Value is too large to fit in a signed 32 bit integer. BSON does not support unsigned values.
Hi!
I am trying to get the server status from the memcache client using its method Stats().
ServerStats status = MemCachedClient.Stats();
To get the server status info you need to use the next method:
GetRaw(IPEndPoint server, string key)
So I created an IPEndPoint object and used it as a parameter:
var uptime = status .GetRaw(new IPEndPoint(IPAddress.Parse("XXX.XXX.XX.XX"), 11211), "uptime");
The problem is that the IPEndPoint that I instanciated and passed as a parameter and the IPEndPoint that is inside the ServerStats class have different AddressFamily.
new IPEndPoint() -> AddressFamily = InterNetwork
IPEndPoint inside the ServerStats -> AddressFamily = Unspecified
So when I do GetRaw(), it does not find the IPEndPoint because the AddresFamily is different.
Is there any way to get the server status info?
Thanks!
Error reading memcache with expiry
i stored/write memcache with below code but not able to read with key
MemcachedClient.Store(StoreMode.Set, "abc", "10",new TimeSpan(0,23, 0, 0));
I tried with two methods, timespan and datetime
When running a dotnet core application with the EnyimMemcached client service registered, if one of the connected servers is stopped and restarted, the IMemcachedClient instance hangs infinitely when calling StoreAsync on the client instance. The last log that comes from from Enyim.Caching.Configuration.MemcachedClientConfiguration is "Socket was reset. (socket GUID)".
Here's the easiest way to reproduce the problem
public void ConfigureServices(IServiceCollection services)
{
...
services.AddEnyimMemcached((cacheConfig) =>
{
//Add servers (point to Docker container on the port forwarded to localhost)
cacheConfig.AddServer("127.0.0.1", 11211);
});
...
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
...
app.UseEnyimMemcached();
...
}
Hi, I follow the guide, but it does not work when I use IDistributedCache, do I have any omissions?
_memcachedClient.Store(StoreMode.Set, key, value);
Sometimes when i setting the value to cache - the log gets a record with text
Enyim.Caching.MemcachedClient
PerformStore
what is this error?
When running on Amazon Elasticache (memcached 1.5.10) I get the below error, since recently. Running locally on my machine works, no errors. Any ideas?
System.ArgumentOutOfRangeException: Unexpected BsonType value: 0 Parameter name: type at Newtonsoft.Json.Bson.BsonDataReader.ReadType(BsonType type) at Newtonsoft.Json.Bson.BsonDataReader.ReadNormal() at Newtonsoft.Json.Bson.BsonDataReader.Read() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader) at Enyim.Caching.Memcached.DefaultTranscoder.Deserialize[T](CacheItem item) at Enyim.Caching.MemcachedClient.BuildGetCommandResult[T](IGetOperationResult
1 result, IGetOperation command, IOperationResult commandResult)
at Enyim.Caching.MemcachedClient.GetAsync[T](String key)`
It appears it's not possible to set a custom transcoder.
It looks like this would need to be added to MemcachedClientOptions and then picked up by MemcachedClientConfiguration?
How do I turn on logging for EnyimMemcachedCore? StoreAsync is returning false, but I don't know why.
in the asp.net core application, i can be used with code below:
services.AddEnyimMemcached();
app.UseEnyimMemcached();
how to make it work in console application?
I set the value of a key "foo" to empty string. If I use IDistributedCache
interface, cache.Get("foo")
returns null
; if I use IMemcachedClient
, cache.Get("foo")
returns byte[]
correctly.
Digging into the code, looks IDistributedCache.Get
calls Get<T>()
. Why Get()
and Get<T>()
handles empty value differently?
Must be used "hashedKey" instead ok "key" for Get/GetAsync methods #18
I need to cache the dictionary
var dict = new Dictionary<int, HashSet<int>>();
dict.Add(1, new HashSet<int> { 1, 2, 3 });
dict.Add(2, new HashSet<int> { 4, 5, 6 });
var key = "dict_key";
_cacheClient.Store(StoreMode.Set, key, dict);
var obj = _cacheClient.Get<Dictionary<int, HashSet<int>>>(key); <-- this error
Error Message = "Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary[System.Int32,System.Collections.Generic.HashSet[System.Int32]]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize...`
But Dictionary<TKey, TValue> is ISerializable.
Under releases there is only a tag for 2.1.9 your most current release. This makes trying to figure out what changed between 2.1.8 really hard...You should keep a tag every time you release a nuget package that way it is easy for people to stick with a version or help you track down bugs that come out in future releases.
Where are the tags for 2.1.3, 2.1.5, 2.1.7, 2.1.8?
值对于 UInt16 太大或太小。
在 System.UInt16.Parse(String s, NumberStyles style, NumberFormatInfo info)
在 Enyim.Caching.Memcached.Protocol.Text.GetHelper.ReadItem(PooledSocket socket)
在 Enyim.Caching.Memcached.Protocol.Text.GetOperation.ReadResponse(PooledSocket socket)
在 Enyim.Caching.Memcached.MemcachedNode.ExecuteOperation(IOperation op)
在 Enyim.Caching.MemcachedClient.PerformTryGet(String key, UInt64& cas, Object& value)
在 Enyim.Caching.MemcachedClient.TryGet(String key, Object& value)
在 Enyim.Caching.MemcachedClient.Get(String key)
Hi, I am connecting to AWS ElasticCache Cluster, do this package support Amazon.ElastiCacheCluster .NET version?
Hi,
I am Reading/Writing data to AWS Memcache cluster using EnyimMemcachedCore, i see a more time taken Read/Write. I am using AWS Lambda to connect to AWS Memcache cluster adding the log details + Configuration file
Log information
08:26:44 START RequestId: 176fd016-af53-11e8-8c00-57c04b9a2f1a Version: $LATEST
08:26:56 Time taken to add item in cache - 10074 milliseconds.
08:27:06 Time taken to read item from cache - 10033 milliseconds.
08:27:16 Time taken to add item in cache - 10021 milliseconds.
08:27:16 END RequestId: 176fd016-af53-11e8-8c00-57c04b9a2f1a
Configuration
{
"enyimMemcached": {
"Servers": [
{
"Address": "REMOVED_THE_SERVERNAME.cache.amazonaws.com",
"Port": 11211
},
{
"Address": "REMOVED_THE_SERVERNAME.cache.amazonaws.com",
"Port": 11211
},
{
"Address": "REMOVED_THE_SERVERNAME.cache.amazonaws.com",
"Port": 11211
},
{
"Address": "REMOVED_THE_SERVERNAME.cache.amazonaws.com",
"Port": 11211
}
],
"socketPool": {
"minPoolSize": "1",
"maxPoolSize": "100",
"connectionTimeout": "00:00:10",
"receiveTimeout": "00:00:15",
"deadTimeout": "00:02:00",
"queueTimeout": "00:00:00.150"
}
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Warning",
"Microsoft": "Warning"
}
}
}
public async Task<IActionResult> Index()
{
_logger.LogDebug("Executing _memcachedClient.GetValueOrCreateAsync...");
var cacheSeconds = 2000;
var posts = await _memcachedClient.GetValueOrCreateAsync(
CacheKey,
cacheSeconds,
async () => await _blogPostService.GetRecent(10));
_logger.LogDebug("Done _memcachedClient.GetValueOrCreateAsync");
return Ok(posts);
}
测试的时候每次都会进入 await _blogPostService.GetRecent(10)); 这个子方法。
The memcached wiki states the following:
On a good day memcached can serve requests in less than a millisecond. After accounting for outliers due to OS jitter, CPU scheduling, or network jitter, very few commands should take more than a millisecond or two to complete.
I am testing to see how long it takes to get/set key and getting on average 63ms for set and 5ms for get. The set is what I am concerned about. 63ms seems a lot. To be fair, that's the first Set. All the consequent Set operations are fast. Is there some initialization happening that I can handle elsewhere?
The servers that I connect to are not doing anything at all. There is plenty of CPU.
The code is below - it's a .NET Core Console app. I am running my test from a Windows Server 2016 x64. The version of the library is 2.1.14. I've ran ping against the memcached boxes and its under a 1 ms.
How do I go about examining where the bottleneck is? Is it the library?
static void Main(string[] args) {
MemcachedClient client = Create();
string key = "foobar-123-9333";
string value = RandomString(1000);
// measure Set
Stopwatch s = Stopwatch.StartNew();
client.Set(key, value, 1000);
Console.WriteLine($"Set {s.ElapsedMilliseconds} ms");
// measure Get
s = Stopwatch.StartNew();
string data = client.Get<string>(key);
Console.WriteLine($"Get {s.ElapsedMilliseconds} ms");
}
static MemcachedClient Create() {
var loggerFactory = new Microsoft.Extensions.Logging.Abstractions.NullLoggerFactory();
var options = new MemcachedClientOptions();
options.Servers.Add(new Server { Address = "10.147.24.9", Port = 11211 });
options.Servers.Add(new Server { Address = "10.147.24.10", Port = 11211 });
var configuration = new MemcachedClientConfiguration(loggerFactory, options);
return new MemcachedClient(loggerFactory, configuration);
}
private static Random random = new Random();
public static string RandomString(int length) {
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
}
It appears a bug is introduced in 2.0.4+ when MinPoolSize and MaxPoolSize are set via SocketPoolOptions (MemcachedClientOptions.cs) and MinPoolSize property in SocketPoolConfiguration.cs has a check to ensure it's less than MaxPoolSize. The issue is when both properties are set in SocketPoolOptions, it will throw ArgumentOutOfRangeException since the default values are 10 and 20 respectively and when I set 50 and 500, it will check MinPoolSize (50) against MaxPoolSize (20). It does not know about the new value yet.
Here's the example that will trigger the exception.
var c = new SocketPoolOptions { MinPoolSize = 50, MaxPoolSize = 500 };
var options = Options.Create(new MemcachedClientOptions { SocketPool = c });
var config = new MemcachedClientConfiguration(_loggerFactory, options);
Sorry I dont know that this is a correct place to ask this question or not:
how is possible to set the ke transformer type in the .net frame work version it was like this :
<enyim.com>
<memcached>
<servers>
<add address="neptune" port="11217" />
</servers>
<socketPool maxPoolSize="200" />
<keyTransformer type="Enyim.Caching.Memcached.TigerHashKeyTransformer, Enyim.Caching" />
</memcached>
</enyim.com>
but in .net core how can I set it in the config file. I can set my servers and ports but dont know how to set the keyTransformer
不建议构造函数依赖ILoggerFactory,支持ILoggerFactory是没问题的,不过没有ILoggerFactory就不能使用,这个不太合理。 建议支持不带ILoggerFactory的构造函数,保持和原Enyim构造函数的兼容性
Hi,
I'm getting an error after upgrade EnyimMemcachedCore to 2.1.7 (.NET Core 2.1).
The error occurs when run it on Linux machine in docker, memcached served on another Linux machine if it matters. Running application locally on Windows it works well (no docker).
And it was working fine on version 2.1.2 targeting on .NET Core 2.0 both Linux and Windows.
fail: Enyim.Caching.Configuration.MemcachedClientConfiguration[33323423],
Create PooledSocket,
System.PlatformNotSupportedException: Sockets on this platform are invalid for use after a failed connection attempt.,
at System.Net.Sockets.Socket.ThrowMultiConnectNotSupported(),
at System.Net.Sockets.Socket.ConnectAsync(SocketAsyncEventArgs e),
at Enyim.Caching.Memcached.PooledSocket.ConnectWithTimeout(Socket socket, DnsEndPoint endpoint, Int32 timeout),
at Enyim.Caching.Memcached.PooledSocket..ctor(DnsEndPoint endpoint, TimeSpan connectionTimeout, TimeSpan receiveTimeout, ILogger logger),
at Enyim.Caching.Memcached.MemcachedNode.CreateSocket(),
fail: Enyim.Caching.Configuration.MemcachedClientConfiguration[33323423],
Create PooledSocket,
System.PlatformNotSupportedException: Sockets on this platform are invalid for use after a failed connection attempt.,
at System.Net.Sockets.Socket.ThrowMultiConnectNotSupported(),
at System.Net.Sockets.Socket.ConnectAsync(SocketAsyncEventArgs e),
at Enyim.Caching.Memcached.PooledSocket.ConnectWithTimeout(Socket socket, DnsEndPoint endpoint, Int32 timeout),
at Enyim.Caching.Memcached.PooledSocket..ctor(DnsEndPoint endpoint, TimeSpan connectionTimeout, TimeSpan receiveTimeout, ILogger logger),
at Enyim.Caching.Memcached.MemcachedNode.CreateSocket(),
fail: Enyim.Caching.Configuration.MemcachedClientConfiguration[0],
Could not init pool.,
fail: Enyim.Caching.Configuration.MemcachedClientConfiguration[0],
Could not init pool.,
warn: Enyim.Caching.Configuration.MemcachedClientConfiguration[0],
Marking node Unspecified/xxx.xxx.xx.xx:11211 as dead,
warn: Enyim.Caching.Configuration.MemcachedClientConfiguration[0],
Marking node Unspecified/xxx.xxx.xx.xx::11211 as dead,
EnyimMemcached Started.,
Hosting environment: Production,
Content root path: /app,
Now listening on: http://0.0.0.0:5000,
Application started. Press Ctrl+C to shut down.,
Configuration from appsettings:
"enyimMemcached": {
"Servers": [
{
"Address": "xxx.xxx.xx.xx:",
"Port": 11211
}
],
"socketPool": {
"minPoolSize": "5",
"maxPoolSize": "25",
"connectionTimeout": "00:00:15",
"receiveTimeout": "00:00:15",
"deadTimeout": "00:00:15",
"queueTimeout": "00:00:00.150"
},
"KeyTransformer": "Enyim.Caching.Memcached.SHA1KeyTransformer, EnyimMemcachedCore",
"Transcoder": "ProtoBuf.Caching.Enyim.NetTranscoder, protobuf-net.Enyim"
}
For our project, we do require credentials to use Memcached. Is there support for that?
Thanks,
Gregg
This code always return empty dictionary (keys is IEnumerable)
_memcachedClient.Get(keys);
EnyimMemcachedCore v2.1.8
ExecuteRemoveAsync doesn't hash the key before determine the pool node. Therefore, the remove always fails.
public async Task<IRemoveOperationResult> ExecuteRemoveAsync(string key)
{
IMemcachedNode memcachedNode = this.pool.Locate(key);
should be:
public async Task<IRemoveOperationResult> ExecuteRemoveAsync(string key)
{
string hashedKey = this.keyTransformer.Transform(key);
IMemcachedNode memcachedNode = this.pool.Locate(hashedKey );
And similar for the non-async version. And, hashedKey needs to be passed to OperationFactory.Delete later in the method(s).
The key is hashed in the PerformStoreAsync and PerformTryGet.
I'd make a PR to help out, but I'm not sure which branch to work off.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.