Fmacias.TplQueue.Cache.Abstract 0.1.0-preview.1

Prefix Reserved
This is a prerelease version of Fmacias.TplQueue.Cache.Abstract.
dotnet add package Fmacias.TplQueue.Cache.Abstract --version 0.1.0-preview.1
                    
NuGet\Install-Package Fmacias.TplQueue.Cache.Abstract -Version 0.1.0-preview.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fmacias.TplQueue.Cache.Abstract" Version="0.1.0-preview.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fmacias.TplQueue.Cache.Abstract" Version="0.1.0-preview.1" />
                    
Directory.Packages.props
<PackageReference Include="Fmacias.TplQueue.Cache.Abstract" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fmacias.TplQueue.Cache.Abstract --version 0.1.0-preview.1
                    
#r "nuget: Fmacias.TplQueue.Cache.Abstract, 0.1.0-preview.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fmacias.TplQueue.Cache.Abstract@0.1.0-preview.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fmacias.TplQueue.Cache.Abstract&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Fmacias.TplQueue.Cache.Abstract&version=0.1.0-preview.1&prerelease
                    
Install as a Cake Tool

Fmacias.TplQueue.Cache.Abstract

Reusable cache orchestration primitives for data-job graph dehydration/hydration and lease lifecycle handling.

See also:

Repository-wide packaging and strong-name signing rules are documented in the TplQueue.Adapter root README.

Use this package when you need the cache contracts and reusable hydration workflow without taking a dependency on the concrete in-memory cache implementation.

Install

dotnet add package Fmacias.TplQueue.Cache.Abstract --version 0.1.0-preview.1

Contents

  • CacheAbstract: base workflow implementation.
  • Domain models (CacheEntry, JobNodeDto, runtime node metadata).
  • Factories: CacheEntryFactory, RuntimeNodeTypeResolverFactory.
  • Cache hydration helpers centered on ITypeResolver and IUniversalDataSerializer.

When to use this package

Choose Fmacias.TplQueue.Cache.Abstract when you are:

  • implementing a custom cache provider for IDataJobRoot dehydration and hydration
  • consuming cache-related contracts from another integration package
  • standardizing payload-type resolution and serializer usage without committing to MemCache

Hydration flow

CacheAbstract does not infer payload CLR types from serialized payload content. It hydrates payload nodes in two explicit steps:

  1. JobNodeDto persists PayloadTypeName from payload.GetType().AssemblyQualifiedName.
  2. CacheAbstract.DeserializePayload(...) resolves that stored string through ITypeResolver.
  3. The resolved Type is passed into IUniversalDataSerializer.Deserialize(string, Type).

That split is the reason RuntimeNodeTypeResolver exists: the serializer knows how to materialize payload content for a known CLR type, while the resolver knows how to map persisted type names back to runtime types.

Runtime node type resolution

RuntimeNodeTypeResolver is the default runtime-oriented implementation of ITypeResolver. Internally it uses TypeDeserializer.TryResolveType(...) against an AppDomain, defaulting to AppDomain.CurrentDomain.

Default runtime usage through the Fmacias.TplQueue facade:

using Fmacias.TplQueue;
using Fmacias.TplQueue.Cache.MemCache;
using Fmacias.TplQueue.Contracts;

IUniversalDataSerializer jsonSerializer = api.SystemTextSerializerFactory().Serializer();
IUniversalDataSerializer xmlSerializer = api.XmlSerializerFactory().Serializer();

IMemCache cache = api.Cache<IMemCache>(
    MemCacheFactory.Create(),
    jsonSerializer);

If you need an explicit resolver, keep using the advanced overload:

using Fmacias.TplQueue.Cache.Abstract.Factories;

ITypeResolver typeResolver = RuntimeNodeTypeResolverFactory.Create().Resolver();

IMemCache cache = api.Cache<IMemCache>(
    MemCacheFactory.Create(),
    jsonSerializer,
    typeResolver);

Custom AppDomain usage through the public factory:

using Fmacias.TplQueue.Cache.Abstract.Factories;
using Fmacias.TplQueue.Contracts;

AppDomain customAppDomain = AppDomain.CurrentDomain; // replace with your application-selected AppDomain when applicable
IRuntimeNodeTypeResolver runtimeResolver =
    RuntimeNodeTypeResolverFactory.Create().Resolver(customAppDomain);

If you need a stricter policy than runtime assembly scanning, provide your own ITypeResolver:

using Fmacias.TplQueue.Contracts;
using Fmacias.TplQueue.Defaults;
using System;

public sealed class PluginDomainTypeResolver : ITypeResolver
{
    private readonly AppDomain _appDomain;

    public PluginDomainTypeResolver(AppDomain appDomain)
    {
        _appDomain = appDomain ?? throw new ArgumentNullException(nameof(appDomain));
    }

    public Type Resolve(string payloadTypeName)
    {
        if (string.IsNullOrWhiteSpace(payloadTypeName))
            throw new ArgumentException("Payload type name cannot be null or whitespace.", nameof(payloadTypeName));

        if (!TypeDeserializer.TryResolveType(payloadTypeName, out var type, _appDomain))
            throw new InvalidOperationException($"Cannot resolve payload CLR type '{payloadTypeName}'.");

        return type;
    }
}

Use that resolver exactly like the default one:

AppDomain customAppDomain = AppDomain.CurrentDomain; // replace with your application-selected AppDomain when applicable
ITypeResolver typeResolver = new PluginDomainTypeResolver(customAppDomain);

Hydration into queue dispatch

After a cache hydrates a payload graph, dispatch the returned IDataJobRoot through the normal queue API:

cache.Dehydrate(payloadRoot, isFifo: false);

ILogger<IParallelQ> queueLogger = loggerFactory.CreateLogger<IParallelQ>();

if (cache.TryHydrateNextJob(out IDataJobRoot hydratedRoot, out ICacheEntry lease))
{
    IParallelQ queue = api.QFactory.Parallel("main", queueLogger);

    queue.Enqueue(hydratedRoot, CancellationToken.None);
    queue.ResumePolling();

    await hydratedRoot.WaitUntilFinishedAsync();
}

Use jsonSerializer or xmlSerializer during cache creation depending on the storage format you want. The hydration flow remains the same because cache modules depend on IUniversalDataSerializer.

Design note

Keeping ITypeResolver separate from IUniversalDataSerializer is the cleaner SRP boundary for this module:

  • type identity lookup is a runtime concern
  • payload materialization is a serialization concern
  • cache hydration composes both concerns but does not collapse them into one interface

Compatibility note

Some public contracts still expose JSON-oriented names such as PayloadJson and IUniversalDataSerializer.Deserialize(string json, Type type). Those names are retained for compatibility and should be read as serializer-specific payload content, not as a JSON-only storage rule.

Runtime type resolution status

Current state:

  • RuntimeNodeTypeResolver uses AppDomain because the current implementation is compatibility-first and simple to wire
  • this remains adequate while payload CLR types live in the default host runtime or another explicitly selected AppDomain

Deferred work:

  • when dynamic plugin loading becomes a first-class scenario in modern .NET, move the dedicated-loading design toward AssemblyLoadContext
  • preserve the ITypeResolver boundary so the runtime loading mechanism can change without redesigning the serializer contract

Local pipeline

Run from TplQueue.Adapter root:

  1. Build module:
dotnet build .\src\Fmacias.TplQueue.Cache.Abstract\Fmacias.TplQueue.Cache.Abstract.csproj
  1. Run module tests:
dotnet test .\test\Fmacias.TplQueue.Cache.Abstract.Test\Fmacias.TplQueue.Cache.Abstract.Test.csproj
  1. Pack through ordered repo pipeline:
powershell -NoProfile -ExecutionPolicy Bypass -File .\pack-local.ps1
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Fmacias.TplQueue.Cache.Abstract:

Package Downloads
Fmacias.TplQueue.Cache.MemCache

In-memory cache provider for TplQueue data-job dehydration, hydration, lease handling, and lightweight package-consumption scenarios.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.1 55 5/21/2026

Preview release of the TplQueue adapter package line for .NET Standard 2.0. This release focuses on public package metadata, consumer-facing README documentation, and strong-name-ready official build support ahead of the first stable 1.0.0 release.