Sharing SOSS cache between .Net Framework and .Net Core apps

Hi there,

We're currently using SOSS (StateServer) in an framework 4.7.1 app using Soss.Client.NamedCache referenced from C:\Program Files\ScaleOut_Software\StateServer\DOTNET4.6\soss_namedcache.dll.

We're now developing a second app that's an core 2.1 Rest API that we'd like to be able to share cache with. How do we go about doing this? Do we use C:\Program Files\ScaleOut_Software\StateServer\DOTNET4.6\soss_namedcache.dll here as well, or something else?

Note that we don't have the ability to make any non-trivial changes to our use of Soss.Client.NamedCache in the framework 4.7.1 app. Also, my question is for SOSS cache sharing and not for sharing session data.

Help would be much appreciated, thanks!


Staff member
You'll need to use the Scaleout.Client NuGet package--it's our latest client library (a .NET Standard library that can run under .NET Core). The original Soss.Client.NamedCache library that ships with the product will only run under the traditional .NET 4.x Framework.

If you're going to use these two different libraries to share data, one gotcha is string key encoding. The NamedCache uses Unicode keys, and the newer Scaleout.Client library uses UTF-8 by default. To make them compatible, you just need to plug in the legacy key encoder that's provided in the new API:

var grid = GridConnection.Connect("bootstrapGateways=localhost:721");
var cacheBuilder = new CacheBuilder<string, MyClass>("my shared cache", grid);
// Use a key encoder that's compatible with the NamedCache API:
cacheBuilder.SetKeyEncoder(new Scaleout.Client.KeyEncoding.LegacyStringKeyEncoder());

Cache<string, MyClass> cache = cacheBuilder.Build();
Also, I'm assuming that MyClass in the example above is some kind of trivially serializable class that both your .NET Framework app and your .NET Core app know how to deal with. You can use the CacheBuilder's SetSerialization method to plug in a custom serializer to match what your Framework 4.7.1 is doing, if needed.