/
veer
/
Zaya.Translator
Обзор
Документация
Войти
/
veer
/
Zaya.Translator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
docs/api/Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.html
490 строк
28 KB
Vladimir Makarov
Extract TranslatorCache as a separate interface and Memory plugin.
01 авг 2026, 22:01
01 авг 2026, 22:01
d289f8b
Код
Авторство
О чём код?
<!DOCTYPE html> <!--[if IE]><![endif]--> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Class MemoryTranslatorCacheService </title> <meta name="viewport" content="width=device-width"> <meta name="title" content="Class MemoryTranslatorCacheService "> <meta name="description" content="In-memory translation cache engine (exact dictionary + optional TTL)."> <link rel="shortcut icon" href="../favicon.ico"> <link rel="stylesheet" href="../styles/docfx.vendor.min.css"> <link rel="stylesheet" href="../styles/docfx.css"> <link rel="stylesheet" href="../styles/main.css"> <meta property="docfx:navrel" content="../toc.html"> <meta property="docfx:tocrel" content="toc.html"> </head> <body data-spy="scroll" data-target="#affix" data-offset="120"> <div id="wrapper"> <header> <nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="../index.html"> <img id="logo" class="svg" src="../logo.svg" alt=""> </a> </div> <div class="collapse navbar-collapse" id="navbar"> <form class="navbar-form navbar-right" role="search" id="search"> <div class="form-group"> <input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off"> </div> </form> </div> </div> </nav> <div class="subnav navbar navbar-default"> <div class="container hide-when-search" id="breadcrumb"> <ul class="breadcrumb"> <li></li> </ul> </div> </div> </header> <div role="main" class="container body-content hide-when-search"> <div class="sidenav hide-when-search"> <a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a> <div class="sidetoggle collapse" id="sidetoggle"> <div id="sidetoc"></div> </div> </div> <div class="article row grid-right"> <div class="col-md-10"> <article class="content wrap" id="_content" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService"> <h1 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService" class="text-break">Class MemoryTranslatorCacheService</h1> <div class="markdown level0 summary"><p>In-memory translation cache engine (exact dictionary + optional TTL).</p> </div> <div class="markdown level0 conceptual"></div> <div class="inheritance"> <h5>Inheritance</h5> <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div> <div class="level1"><span class="xref">MemoryTranslatorCacheService</span></div> </div> <div class="implements"> <h5>Implements</h5> <div><a class="xref" href="Zaya.TranslatorCache.Services.ITranslatorCacheService.html">ITranslatorCacheService</a></div> <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a></div> </div> <div class="inheritedMembers"> <h5>Inherited Members</h5> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a> </div> </div> <h6><strong>Namespace</strong>: <a class="xref" href="Zaya.html">Zaya</a>.<a class="xref" href="Zaya.TranslatorCache.html">TranslatorCache</a>.<a class="xref" href="Zaya.TranslatorCache.Impl.html">Impl</a>.<a class="xref" href="Zaya.TranslatorCache.Impl.Memory.html">Memory</a>.<a class="xref" href="Zaya.TranslatorCache.Impl.Memory.Services.html">Services</a></h6> <h6><strong>Assembly</strong>: Zaya.TranslatorCache.Impl.Memory.dll</h6> <h5 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_syntax">Syntax</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public sealed class MemoryTranslatorCacheService : ITranslatorCacheService, IDisposable</code></pre> </div> <h3 id="fields">Fields </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_EngineIdValue.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.EngineIdValue%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L14">View Source</a> </span> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_EngineIdValue" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.EngineIdValue">EngineIdValue</h4> <div class="markdown level1 summary"><p>Stable engine id used in profiles and plugin discovery.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public const string EngineIdValue = "memory-translator-cache"</code></pre> </div> <h5 class="fieldValue">Field Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td> <td></td> </tr> </tbody> </table> <h3 id="properties">Properties </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Description.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Description%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L30">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Description_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Description*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Description" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Description">Description</h4> <div class="markdown level1 summary"><p>Gets the UI description for this engine (localized).</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public LocalizedString Description { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://shtrasser-dev.github.io/Zaya.Primitives/api/Zaya.Primitives.LocalizedString.html">LocalizedString</a></td> <td></td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_DisplayName.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.DisplayName%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L27">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_DisplayName_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.DisplayName*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_DisplayName" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.DisplayName">DisplayName</h4> <div class="markdown level1 summary"><p>Gets the UI display name for this engine (localized).</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public LocalizedString DisplayName { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://shtrasser-dev.github.io/Zaya.Primitives/api/Zaya.Primitives.LocalizedString.html">LocalizedString</a></td> <td></td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_EngineId.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.EngineId%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L24">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_EngineId_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.EngineId*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_EngineId" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.EngineId">EngineId</h4> <div class="markdown level1 summary"><p>Gets a unique identifier for this cache engine (e.g. "memory-translator-cache"). Used for profile serialization and engine lookup.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public string EngineId { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td> <td></td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_IsAvailable.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.IsAvailable%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L33">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_IsAvailable_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.IsAvailable*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_IsAvailable" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.IsAvailable">IsAvailable</h4> <div class="markdown level1 summary"><p>Gets whether this cache engine is available on the current system.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public bool IsAvailable { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td> <td></td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Settings.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Settings%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L36">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Settings_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Settings*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Settings" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Settings">Settings</h4> <div class="markdown level1 summary"><p>Gets the list of engine-specific settings that can be configured via UI.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public IReadOnlyList<SettingDescriptor> Settings { get; }</code></pre> </div> <h5 class="propertyValue">Property Value</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1">IReadOnlyList</a><<a class="xref" href="https://shtrasser-dev.github.io/Zaya.Primitives/api/Zaya.Primitives.SettingDescriptor.html">SettingDescriptor</a>></td> <td></td> </tr> </tbody> </table> <h3 id="methods">Methods </h3> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Dispose.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Dispose%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L66">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Dispose_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Dispose*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_Dispose" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.Dispose">Dispose()</h4> <div class="markdown level1 summary"><p>Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public void Dispose()</code></pre> </div> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_WrapSessionAsync_Zaya_Translator_Services_ITranslatorSession_System_Collections_Generic_IReadOnlyDictionary_System_String_System_Object__System_Threading_CancellationToken_.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.WrapSessionAsync(Zaya.Translator.Services.ITranslatorSession%2CSystem.Collections.Generic.IReadOnlyDictionary%7BSystem.String%2CSystem.Object%7D%2CSystem.Threading.CancellationToken)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L51">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_WrapSessionAsync_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.WrapSessionAsync*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_WrapSessionAsync_Zaya_Translator_Services_ITranslatorSession_System_Collections_Generic_IReadOnlyDictionary_System_String_System_Object__System_Threading_CancellationToken_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.WrapSessionAsync(Zaya.Translator.Services.ITranslatorSession,System.Collections.Generic.IReadOnlyDictionary{System.String,System.Object},System.Threading.CancellationToken)">WrapSessionAsync(ITranslatorSession, IReadOnlyDictionary<string, object>, CancellationToken)</h4> <div class="markdown level1 summary"><p>Wraps a raw translator session with caching according to the specified settings.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public Task<ITranslatorSession> WrapSessionAsync(ITranslatorSession inner, IReadOnlyDictionary<string, object> engineSettings, CancellationToken cancellationToken = default)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="Zaya.Translator.Services.ITranslatorSession.html">ITranslatorSession</a></td> <td><span class="parametername">inner</span></td> <td><p>The session to wrap. Ownership transfers to the returned session.</p> </td> </tr> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlydictionary-2">IReadOnlyDictionary</a><<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a>, <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a>></td> <td><span class="parametername">engineSettings</span></td> <td><p>Engine-specific settings dictionary.</p> </td> </tr> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></td> <td><span class="parametername">cancellationToken</span></td> <td><p>Token to cancel wrapping.</p> </td> </tr> </tbody> </table> <h5 class="returns">Returns</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="Zaya.Translator.Services.ITranslatorSession.html">ITranslatorSession</a>></td> <td><p>A session that may cache translation results (or <code class="paramref">inner</code> if caching is disabled).</p> </td> </tr> </tbody> </table> <span class="small pull-right mobile-hide"> <span class="divider">|</span> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_WrapSessionAsync_Zaya_Translator_Services_ITranslatorSession_System_Threading_CancellationToken_.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.WrapSessionAsync(Zaya.Translator.Services.ITranslatorSession%2CSystem.Threading.CancellationToken)%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A">Edit this page</a> </span> <span class="small pull-right mobile-hide"> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L39">View Source</a> </span> <a id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_WrapSessionAsync_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.WrapSessionAsync*"></a> <h4 id="Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService_WrapSessionAsync_Zaya_Translator_Services_ITranslatorSession_System_Threading_CancellationToken_" data-uid="Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService.WrapSessionAsync(Zaya.Translator.Services.ITranslatorSession,System.Threading.CancellationToken)">WrapSessionAsync(ITranslatorSession, CancellationToken)</h4> <div class="markdown level1 summary"><p>Wraps a raw translator session with caching according to default engine settings.</p> </div> <div class="markdown level1 conceptual"></div> <h5 class="declaration">Declaration</h5> <div class="codewrapper"> <pre><code class="lang-csharp hljs">public Task<ITranslatorSession> WrapSessionAsync(ITranslatorSession inner, CancellationToken cancellationToken = default)</code></pre> </div> <h5 class="parameters">Parameters</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Name</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="Zaya.Translator.Services.ITranslatorSession.html">ITranslatorSession</a></td> <td><span class="parametername">inner</span></td> <td><p>The session to wrap. Ownership transfers to the returned session.</p> </td> </tr> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></td> <td><span class="parametername">cancellationToken</span></td> <td><p>Token to cancel wrapping.</p> </td> </tr> </tbody> </table> <h5 class="returns">Returns</h5> <table class="table table-bordered table-condensed"> <thead> <tr> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a><<a class="xref" href="Zaya.Translator.Services.ITranslatorSession.html">ITranslatorSession</a>></td> <td><p>A session that may cache translation results.</p> </td> </tr> </tbody> </table> <h3 id="implements">Implements</h3> <div> <a class="xref" href="Zaya.TranslatorCache.Services.ITranslatorCacheService.html">ITranslatorCacheService</a> </div> <div> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a> </div> </article> </div> <div class="hidden-sm col-md-2" role="complementary"> <div class="sideaffix"> <div class="contribution"> <ul class="nav"> <li> <a href="https://github.com/shtrasser-dev/Zaya.Translator/new/main/apiSpec/new?filename=Zaya_TranslatorCache_Impl_Memory_Services_MemoryTranslatorCacheService.md&value=---%0Auid%3A%20Zaya.TranslatorCache.Impl.Memory.Services.MemoryTranslatorCacheService%0Asummary%3A%20'*You%20can%20override%20summary%20for%20the%20API%20here%20using%20*MARKDOWN*%20syntax'%0A---%0A%0A*Please%20type%20below%20more%20information%20about%20this%20API%3A*%0A%0A" class="contribution-link">Edit this page</a> </li> <li> <a href="https://github.com/shtrasser-dev/Zaya.Translator/blob/main/src/Zaya.TranslatorCache.Impl.Memory/Services/MemoryTranslatorCacheService.cs/#L11" class="contribution-link">View Source</a> </li> </ul> </div> <nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix"> <h5>In this article</h5> <div></div> </nav> </div> </div> </div> </div> <footer> <div class="grad-bottom"></div> <div class="footer"> <div class="container"> <span class="pull-right"> <a href="#top">Back to top</a> </span> <span>Generated by <strong>DocFX</strong></span> </div> </div> </footer> </div> <script type="text/javascript" src="../styles/docfx.vendor.min.js"></script> <script type="text/javascript" src="../styles/docfx.js"></script> <script type="text/javascript" src="../styles/main.js"></script> </body> </html>