.NET Standard 2.0 support
:update: Version 1.2.0 of CacheManager was released with the 1.x branch targeting .NetStandard 2.0, including the change to the new redis client version.
Breaking Change
I will drop any lower netstandard target in packages which had .netstandard1.x. Also, .NET4.0 support will be removed. Because this is a bigger change, this will be a major version release (2.0), together with upgrading Stackexchange.Redis to 2.x, see #251.
Changes
- [x] Setup Unit Tests to run against netstandard1.x and netstandard2.x as code paths will be different
- [x] Add nestandard2.0 to CM.Core
- Binary Serialization supported in netstandard2.0 but
System.Typewill not be supported... => no support for Binary Serializer in netstandard2.0 - [x] Support "old" configuration system by using
System.Configuration.ConfigurationManager - [x] Support Performance Counters ~~(package is currently in preview and breaks other projects because of mismatching deps)~~
- Binary Serialization supported in netstandard2.0 but
- [x] Multitarget System.Runtime.Caching based cache handle with netstandard2.0
- differences of this cache on nestandard2.0 vs full framework seem to be accepted by MS and will be documented
- [x] Changing all (appropriate) sub packages to target netstandard2.0, too and change deps versions
- [x] Json package keeps referencing Newtonsoft.Json 9.0.1 for old targets. netstandard2.0 will require 11.0.1 though
- [x] Update MS.Bond deps to 7.0.1 (except .NET4.0 which is supported till Bond 6.0 only)
- [x] Update Protobuf-net reference to 2.3.7 which also has a netstandard2.0 target now (although it still references older corefx packages)
- [x] CM Logging and Configuration additions to the MS packages will reference MS' version 2.0.0 as minimal version for netstandard2.0 target.
- [x] Use Redis package with netstandard2.0 target (doesn't exist yet)
- [x] Update readme with new targets
- [ ] Maybe integrated MS DI as a core dependency and replace the setup code with actually using DI.
any news on this? or more poignantly, any where to get the nuget package(s)? :)
@bbqchickenrobot you can get the beta packages from the myget feed and give it a try until I release it. I have to do more testing and maybe waiting for 2.1... In case you want to use System.Runtime.Caching on .NET Core, be aware that this is not released by MS yet (I'm using 4.5.0-preview1 atm)...
So if it looks like system.type will not have binary serialization support, does that mean we will just have to use .WithJsonSerializer() if we are targeting .netstandard2.0?
@maldworth You can use any other serializer wich supports .NET Core
Main changes to target netstandard 2.0 are done I decided to drop most old targets in the process. E.g. .NET 4.0 will not be available anymore and .netstandard1.x not either. Most of the packages now require .NET461 | netstandard2.0 This allows a lot simplifications in code. I was able to remove almost all ifdefs, which makes testing a lot easier...
I'm not really happy of how some DI things work right now with the DI extension package, so I might actually rework that quite a bit. The idea would be to integrated the Microsoft.Extensions.Di into the CacheManager.Core package. That would become a primary dependency everywhere though. I then would replace my custom initialization via reflection with actually using the DI. I might implement named CacheManager instances/configuartion, too. The existing exposed functionality of CacheFactory should still work though by hiding the DI container...
Very happy to see this effort! :)
I decided to re-release 1.1.2 with just the Redis upgarde and some .NET Standard 2.0 support additions. That's version 1.2.0 which has just been released!
There are no new features or ported functionality to .NETStandard 2.0 in that CacheManager 1.2.0 release. It is exactly the same code as 1.1.2 but with those 2 additions.
Hope that helps!
Need help with anything?
Hello, any news on when the 2.x version will be released ? Thank you.
Any updates?
Hi, We really like CacheManager and would like to continue using it in the future. We are in the process of migrating to .net core and this is something that we obviously need to take into consideration. Understood its an open source project and nobody owes anyone anything. We would still kindly ask any update of whether it is still on your personal roadmap?
Thanks!
@amirxnz you can totally use the current release with .NET Core and ASP.NET Core, I'm using it for the past 2 years in production.
CM Version 1.2.0 targets .netstandard 2.0, which means you can use it with everything .NET Core and there shouldn't really be any issues... Otherwise, let me know.
Hi, Thank you for the answer.
We are having some trouble with the CacheManager.SystemRuntimeCaching? It looks like 1.2 is only for framework 4.5? (https://www.nuget.org/packages/CacheManager.SystemRuntimeCaching)
It is our understanding that this package is needed if we want to keep the results locally in addition to having a redis backplane? Is this correct?
Thanks
System.Runtime.Caching has been back ported to .NET Core with some minor breaking changes.
The CacheManager package for that one is not released yet, that's correct.
As an alternative, you can use CM with Microsoft.Extensions.Caching instead or just the simple dictionary cache from the CacheManager.Core package. Both work cross plat.
Is my understanding correct that iff we use the simple "WithDictionaryHandle()" that means that we need to make sure there are no concurrency issues? However "CM with Microsoft.Extensions.Caching" is already thread-safe since it uses a concurrent dictionary? Are there any downsides to using Microsoft.Extensions.Caching?
Thanks again for all your support, we really appreciate it
Hey @amirxnz, no, the simple CM Dictionary handle also uses a ConcurrentDictionary internally and is supposed to be thread-safe. The main difference to Microsoft.Extensions.Caching is that CM Dictionary is faster because it doesn't implement a complicated CacheItem policy thing. And CM Dictionary checks for expired items more frequently. Microsoft.Extensions.Caching does run a check every 2 minutes or so, CM Dictionary does it every 10sec I think.
So, just choose the one you think works best for you.
Ok Thanks! I think we'll start with CM Dictionary and see how that treats us.
ask for help
https://github.com/MichaCo/CacheManager/issues/323
I have two projects operating a redis. One is the . Net framework and the other is the . Net CORE
This causes the. Net framework project to write to a cache . . Net core project that cannot be serialized
But. Net core does not have withbinaryserializer. How can I replace it ?
` #if !NETSTANDARD2
/// <summary>
/// Configures a <see cref="BinaryCacheSerializer"/> to be used for serialization and deserialization.
/// </summary>
/// <returns>The builder part.</returns>
public ConfigurationBuilderCachePart WithBinarySerializer()
{
Configuration.SerializerType = typeof(BinaryCacheSerializer);
return this;
}
/// <summary>
/// Configures a <see cref="BinaryCacheSerializer"/> to be used for serialization and deserialization.
/// </summary>
/// <param name="serializationFormatter">The <see cref="BinaryFormatter"/> for serialization.</param>
/// <param name="deserializationFormatter">The <see cref="BinaryFormatter"/> for deserialization.</param>
/// <returns>The builder part.</returns>
public ConfigurationBuilderCachePart WithBinarySerializer(BinaryFormatter serializationFormatter, BinaryFormatter deserializationFormatter)
{
Configuration.SerializerType = typeof(BinaryCacheSerializer);
Configuration.SerializerTypeArguments = new object[] { serializationFormatter, deserializationFormatter };
return this;
}
#endif `