blob: a178bd384078d284448bfff8f3169d8f079697a3 [file] [log] [blame]
<!doctype html>
<html class="docs-version-1.1.0" lang="zh-CN" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Docusaurus v2.0.0-beta.14">
<link rel="alternate" type="application/rss+xml" href="/zh-CN/blog/rss.xml" title="Apache Linkis Blog RSS Feed">
<link rel="alternate" type="application/atom+xml" href="/zh-CN/blog/atom.xml" title="Apache Linkis Blog Atom Feed">
<link rel="search" type="application/opensearchdescription+xml" title="Apache Linkis" href="/zh-CN/opensearch.xml"><title data-react-helmet="true">CS Cache 架构 | Apache Linkis</title><meta data-react-helmet="true" name="twitter:card" content="summary_large_image"><meta data-react-helmet="true" property="og:url" content="https://linkis.incubator.apache.org/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache"><meta data-react-helmet="true" name="docsearch:language" content="zh-CN"><meta data-react-helmet="true" name="docsearch:version" content="1.1.0"><meta data-react-helmet="true" name="docsearch:docusaurus_tag" content="docs-default-1.1.0"><meta data-react-helmet="true" property="og:title" content="CS Cache 架构 | Apache Linkis"><meta data-react-helmet="true" name="description" content="CSCache架构"><meta data-react-helmet="true" property="og:description" content="CSCache架构"><link data-react-helmet="true" rel="shortcut icon" href="/zh-CN/img/favicon.ico"><link data-react-helmet="true" rel="canonical" href="https://linkis.incubator.apache.org/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache"><link data-react-helmet="true" rel="alternate" href="https://linkis.incubator.apache.org/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache" hreflang="en"><link data-react-helmet="true" rel="alternate" href="https://linkis.incubator.apache.org/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache" hreflang="zh-CN"><link data-react-helmet="true" rel="alternate" href="https://linkis.incubator.apache.org/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache" hreflang="x-default"><link data-react-helmet="true" rel="preconnect" href="https://AE29KQB3IA-dsn.algolia.net" crossorigin="anonymous"><link rel="stylesheet" href="/zh-CN/assets/css/styles.e9faf9bb.css">
<link rel="preload" href="/zh-CN/assets/js/runtime~main.14d5df0c.js" as="script">
<link rel="preload" href="/zh-CN/assets/js/main.5a9c4743.js" as="script">
</head>
<body>
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</script><div id="__docusaurus">
<div><a href="#" class="skipToContent_OuoZ">Skip to main content</a></div><nav class="navbar navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Navigation bar toggle" class="navbar__toggle clean-btn" type="button" tabindex="0"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/zh-CN/"><img src="/zh-CN/img/logo.png" alt="Apache Linkis Logo" class="themedImage_TMUO themedImage--light_4Vu1 navbar__logo"><img src="/zh-CN/img/logo.png" alt="Apache Linkis Logo" class="themedImage_TMUO themedImage--dark_uzRr navbar__logo"><b class="navbar__title">Apache Linkis(Incubating)</b></a><a class="navbar__item navbar__link" href="/zh-CN/">首页</a><a class="navbar__item navbar__link" href="/zh-CN/faq/main">FAQ</a><a class="navbar__item navbar__link" href="/zh-CN/download/main">下载</a><a class="navbar__item navbar__link" href="/zh-CN/community/how-to-subscribe">社区</a><a class="navbar__item navbar__link" href="/zh-CN/blog">博客</a><a class="navbar__item navbar__link" href="/zh-CN/team">团队</a><a class="navbar__item navbar__link" href="/zh-CN/user">用户</a><div class="navbar__item dropdown dropdown--hoverable"><a class="navbar__link">Apache</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">基金会</a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">证书</a></li><li><a href="https://www.apache.org/events/current-event" target="_blank" rel="noopener noreferrer" class="dropdown__link">事件</a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">安全</a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">赞助</a></li><li><a href="https://www.apache.org/foundation/policies/privacy.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Privacy</a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">致谢</a></li></ul></div></div><div class="navbar__items navbar__items--right"><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a class="navbar__link">文档</a><ul class="dropdown__menu"><li><a class="dropdown__link" href="/zh-CN/docs/1.1.3/introduction">Next(1.1.3)</a></li><li><a class="dropdown__link" href="/zh-CN/docs/latest/introduction">1.1.2</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.1.1/introduction">1.1.1</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.1.0/introduction">1.1.0</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.0.3/introduction">1.0.3</a></li><li><a class="dropdown__link" href="/zh-CN/docs/1.0.2/introduction">1.0.2</a></li><li><a class="dropdown__link" href="/zh-CN/docs/0.11.0/introduction">0.11.0</a></li><li><a class="dropdown__link" href="/zh-CN/versions">All Version</a></li></ul></div><a href="https://github.com/apache/incubator-linkis" target="_blank" rel="noopener noreferrer" class="navbar__item navbar__link header-github-link" aria-label="GitHub"></a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" class="navbar__link"><span><svg t="1631348384596" class="iconLanguage_EbrZ" viewBox="0 0 1024 1024" version="1.1" p-id="557" width="20" height="20"><path d="M547.797333 638.208l-104.405333-103.168 1.237333-1.28a720.170667 720.170667 0 0 0 152.490667-268.373333h120.448V183.082667h-287.744V100.906667H347.605333v82.218666H59.818667V265.386667h459.178666a648.234667 648.234667 0 0 1-130.304 219.946666 643.242667 643.242667 0 0 1-94.976-137.728H211.541333a722.048 722.048 0 0 0 122.453334 187.434667l-209.194667 206.378667 58.368 58.368 205.525333-205.525334 127.872 127.829334 31.232-83.84m231.424-208.426667h-82.218666l-184.96 493.312h82.218666l46.037334-123.306667h195.242666l46.464 123.306667h82.218667l-185.002667-493.312m-107.690666 287.744l66.56-178.005333 66.602666 178.005333z" fill="currentColor" p-id="558"></path></svg><span>简体中文</span></span></a><ul class="dropdown__menu"><li><a href="/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache" target="_self" rel="noopener noreferrer" class="dropdown__link" style="text-transform:capitalize">English</a></li><li><a href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache" target="_self" rel="noopener noreferrer" class="dropdown__link dropdown__link--active" style="text-transform:capitalize">简体中文</a></li></ul></div><div class="searchBox_Bc3W"><button type="button" class="DocSearch DocSearch-Button" aria-label="Search"><span class="DocSearch-Button-Container"><svg width="20" height="20" class="DocSearch-Search-Icon" viewBox="0 0 20 20"><path d="M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z" stroke="currentColor" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path></svg><span class="DocSearch-Button-Placeholder">Search</span></span><span class="DocSearch-Button-Keys"></span></button></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div class="main-wrapper docs-wrapper docs-doc-page"><div class="docPage_lDyR"><button class="clean-btn backToTopButton_i9tI" type="button"><svg viewBox="0 0 24 24" width="28"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z" fill="currentColor"></path></svg></button><aside class="docSidebarContainer_0YBq"><div class="sidebar_a3j0"><nav class="menu thin-scrollbar menu_cyFh menuWithAnnouncementBar_+O1J"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" href="/zh-CN/docs/1.1.0/introduction">Linkis 简述</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" href="/zh-CN/docs/1.1.0/release">版本总览</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">安装部署</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">用户手册</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">引擎使用</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">API文档</a></li><li class="theme-doc-sidebar-item-category menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#">架构分析</a><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/overview">总览</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/difference_between_1.0_and_0.x">Linkis1.0 与 Linkis0.X 的区别简述</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/job_submission_preparation_and_execution_process">Job 提交准备执行流程</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">公共模块</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">计算治理服务架构</a></li><li class="theme-doc-sidebar-item-category menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#" tabindex="0">公共增强服务</a><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/overview">总览</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/public_service">PublicService 公共服务架构</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">BML</a></li><li class="theme-doc-sidebar-item-category menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#" tabindex="0">Context Service统一上下文</a><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/overview">总览</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service">CS 架构</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_cache">CS Cache 架构</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_client">CS Client</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_highavailable">CS HA 架构设计</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_listener">CS Listener 架构</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_persistence">CS Persistence 架构</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_search">CS Search 架构</a></li></ul></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/datasource_manager">DataSource Manager Server 架构</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/metadata_manager">MetaData Manager Server 架构</a></li></ul></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#" tabindex="0">微服务治理架构</a></li><li class="theme-doc-sidebar-item-link menu__list-item"><a class="menu__link" tabindex="0" href="/zh-CN/docs/1.1.0/architecture/add_an_engine_conn">EngineConn 新增流程</a></li></ul></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">开发文档</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">版本升级</a></li><li class="theme-doc-sidebar-item-category menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#">调优排障</a></li></ul></nav></div></aside><main class="docMainContainer_r8cw"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_zHA2"><div class="theme-doc-version-banner alert alert--warning margin-bottom--md" role="alert"><div>This is documentation for <!-- -->Apache Linkis<!-- --> <b>1.1.0</b>, 非最新版本。</div><div class="margin-top--md">有关最新文档,请参阅最新稳定版本<b><a href="/zh-CN/docs/latest/architecture/public_enhancement_services/context_service/context_service_cache">latest version</a></b> (<!-- -->1.1.2<!-- -->).</div></div><div class="docItemContainer_oiyr"><article><span class="theme-doc-version-badge badge badge--secondary">Version: <!-- -->1.1.0</span><div class="tocCollapsible_aw-L theme-doc-toc-mobile tocMobile_Tx6Y"><button type="button" class="clean-btn tocCollapsibleButton_zr6a">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>CS Cache 架构</h1></header><h2><a aria-hidden="true" tabindex="-1" class="anchor anchor__h2 anchorWithStickyNavbar_y2LR" id="cscache架构"></a><strong>CSCache架构</strong><a class="hash-link" href="#cscache架构" title="Direct link to heading">#</a></h2><h3><a aria-hidden="true" tabindex="-1" class="anchor anchor__h3 anchorWithStickyNavbar_y2LR" id="需要解决的问题"></a><strong>需要解决的问题</strong><a class="hash-link" href="#需要解决的问题" title="Direct link to heading">#</a></h3><h3><a aria-hidden="true" tabindex="-1" class="anchor anchor__h3 anchorWithStickyNavbar_y2LR" id="11-内存结构需要解决的问题"></a>1.1. 内存结构需要解决的问题:<a class="hash-link" href="#11-内存结构需要解决的问题" title="Direct link to heading">#</a></h3><ol><li><p>支持按ContextType进行拆分:加快存储和查询性能</p></li><li><p>支持按不同得ContextID进行拆分:需要完成ContextID见元数据隔离</p></li><li><p>支持LRU:按照特定算法进行回收</p></li><li><p>支持按关键字进行检索:支持通过关键字进行索引</p></li><li><p>支持索引:支持直接通过ContextKey进行索引</p></li><li><p>支持遍历:需要支持通过按照ContextID、ContextType进行遍历</p></li></ol><h3><a aria-hidden="true" tabindex="-1" class="anchor anchor__h3 anchorWithStickyNavbar_y2LR" id="12-加载与解析需要解决的问题"></a>1.2 加载与解析需要解决的问题:<a class="hash-link" href="#12-加载与解析需要解决的问题" title="Direct link to heading">#</a></h3><ol><li><p>支持将ContextValue解析成内存数据结构:需要完成对ContextKey和value解析出对应的关键字。</p></li><li><p>需要与与Persistence模块进行对接完成ContextID内容的加载与解析</p></li></ol><h3><a aria-hidden="true" tabindex="-1" class="anchor anchor__h3 anchorWithStickyNavbar_y2LR" id="13-metric和清理机制需要解决的问题"></a>1.3 Metric和清理机制需要解决的问题:<a class="hash-link" href="#13-metric和清理机制需要解决的问题" title="Direct link to heading">#</a></h3><ol><li><p>当JVM内存不够时能够基于内存使用和使用频率的清理</p></li><li><p>支持统计每个ContextID的内存使用情况</p></li><li><p>支持统计每个ContextID的使用频率</p></li></ol><h2><a aria-hidden="true" tabindex="-1" class="anchor anchor__h2 anchorWithStickyNavbar_y2LR" id="contextcache架构"></a><strong>ContextCache架构</strong><a class="hash-link" href="#contextcache架构" title="Direct link to heading">#</a></h2><p>ContextCache的架构如下图展示:</p><p><img src="/zh-CN/assets/images/linkis-contextservice-cache-01-f88da12027f01881d55746cb0ea160e4.png"></p><ol><li><p>ContextService:完成对外接口的提供,包括增删改查;</p></li><li><p>Cache:完成对上下文信息的存储,通过ContextKey和ContextValue进行映射存储</p></li><li><p>Index:建立的关键字索引,存储的是上下文信息的关键字和ContextKey的映射;</p></li><li><p>Parser:完成对上下文信息的关键字解析;</p></li><li><p>LoadModule当ContextCache没有对应的ContextID信息时从持久层完成信息的加载;</p></li><li><p>AutoClear:当Jvm内存不足时完成对ContextCache进行按需清理;</p></li><li><p>Listener:用于手机ContextCache的Metric信息,如:内存占用、访问次数。</p></li></ol><h2><a aria-hidden="true" tabindex="-1" class="anchor anchor__h2 anchorWithStickyNavbar_y2LR" id="contextcache存储结构设计"></a><strong>ContextCache存储结构设计</strong><a class="hash-link" href="#contextcache存储结构设计" title="Direct link to heading">#</a></h2><p><img src="/zh-CN/assets/images/linkis-contextservice-cache-02-141cbbb9fd040b22838d97aa342ceaa8.png"></p><p>ContextCache的存储结构划分为了三层结构:</p><p><strong>ContextCach:</strong>存储了ContextID和ContextIDValue的映射关系,并能够完成ContextID按照LRU算法进行回收;</p><p><strong>ContextIDValue:</strong>拥有存储了ContextID的所有上下文信息和索引的CSKeyValueContext。并统计ContestID的内存和使用记录。</p><p><strong>CSKeyValueContext:</strong>包含了按照类型存储并支持关键词的CSInvertedIndexSet索引集,还包含了存储ContextKey和ContextValue的存储集CSKeyValueMapSet。</p><p>CSInvertedIndexSet:通过CSType进行分类存储关键词索引</p><p>CSKeyValueMapSet:通过CSType进行分类存储上下文信息</p><h2><a aria-hidden="true" tabindex="-1" class="anchor anchor__h2 anchorWithStickyNavbar_y2LR" id="contextcache-uml类图设计"></a><strong>ContextCache UML类图设计</strong><a class="hash-link" href="#contextcache-uml类图设计" title="Direct link to heading">#</a></h2><p><img src="/zh-CN/assets/images/linkis-contextservice-cache-03-f43df4b6ed2844192de9058e9bc0d376.png"></p><h2><a aria-hidden="true" tabindex="-1" class="anchor anchor__h2 anchorWithStickyNavbar_y2LR" id="contextcache-时序图"></a><strong>ContextCache 时序图</strong><a class="hash-link" href="#contextcache-时序图" title="Direct link to heading">#</a></h2><p>下面的图绘制了以ContextID、KeyWord、ContextType去ContextCache中查对应的ContextKeyValue的整体流程。
<img src="/zh-CN/assets/images/linkis-contextservice-cache-04-0a5c853730499dbb674bb4e172cc88d6.png"></p><p>说明:其中ContextIDValueGenerator会去持久层拉取ContextID的Array<!-- -->[ContextKeyValue]<!-- -->,并通过ContextKeyValueParser解析ContextKeyValue的关键字存储索引和内容。</p><p>ContextCacheService提供的其他接口流程类似,这里不再赘述。</p><h2><a aria-hidden="true" tabindex="-1" class="anchor anchor__h2 anchorWithStickyNavbar_y2LR" id="keyword解析逻辑"></a><strong>KeyWord解析逻辑</strong><a class="hash-link" href="#keyword解析逻辑" title="Direct link to heading">#</a></h2><p>ContextValue具体的实体Bean需要在对应可以作为keyword的get方法上面使用注解\@keywordMethod,比如Table的getTableName方法必须加上\@keywordMethod注解。</p><p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAATwAAABpCAIAAAAoUwihAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAhuSURBVHhe7ZxBbxy3GYbzK3vxL+itt8CXnPoHVMSHwEDPgZqLiyKBDw4QnxzEsHOIDt0AUlGhiuDCMFI4sB3YVr+P5JAfyZmRdnZnNJSeFw8EzrdckgL4LEcL7X5yQQhpKqW0795/CC1CyGry27v3oVVL++b3D1989587948AYCX86cuNiBkURVqA9YO0AI2BtACNgbQAjYG0AI2BtACNsZy0MlpRsdhH3cwpsQ4AwozSytMvrUTcbJp4WTQAwDPvSSsjFJVeYre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92OD+dkqnQS1n26tkjVqSUpPgxQXGq8aV1/SRTet7P7YSNtVxft/Zj1Igm5puxZ2nRCBmTHW0/KDipJ5UNPnxCnUzRTnlhKq0+v4uQMDxXSZv2NtHHYro20ZDVZ6PY47nIV0hxuLl5FxfvZ18dFLZVulVEhxWUWf0pPl7ZaJCHXlaWlrY5HvQUtNaj7aGQcvVU2SotIYyNLz+7WOjx3urR8rQxZTRaX1h+k4dRydZXNXypes7KPryRXQzf7F6/+/Vl20EYYp1tPGFnvdbeRtm+RhFxL5pF2m3Q3ri5JvKvF9M8E3nd2WiQhe831S5sfYtn97RUST0V7PM6QnRZJyD6zAmkJIdsEaQlpLEhLSGNBWkIaC9IS0lgukVYiD38ghKwpl0hLCFlzkJaQxoK0hDSVi4v/A9Y9mq9gebT+AAAAAElFTkSuQmCC"></p><p>ContextKeyValueParser在解析ContextKeyValue的时候,会去扫描传入的具体对象的所有被KeywordMethod修饰的注解并调用该get方法获得返回对象toString并会通过用户可选的规则进行解析,存入keyword集合里面。规则有分隔符,和正则表达式</p><p>注意事项:</p><ol><li><p>该注解会定义到cs的core模块</p></li><li><p>被修饰的Get方法不能带参数</p></li><li><p>Get方法的返回对象的toSting方法必须返回的是关键字</p></li></ol></div><footer class="theme-doc-footer docusaurus-mt-lg"><div class="theme-doc-footer-edit-meta-row row"><div class="col"><a href="https://github.com/apache/incubator-linkis-website/edit/dev/i18n/zh-CN/docusaurus-plugin-content-docs/version-1.1.0/architecture/public_enhancement_services/context_service/context_service_cache.md" target="_blank" rel="noreferrer noopener" class="theme-edit-this-page"><svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" class="iconEdit_mS5F" aria-hidden="true"><g><path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z"></path></g></svg>编辑</a></div><div class="col lastUpdated_mt2f"></div></div></footer></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages navigation"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service"><div class="pagination-nav__sublabel">上一篇</div><div class="pagination-nav__label">« <!-- -->CS 架构</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/zh-CN/docs/1.1.0/architecture/public_enhancement_services/context_service/context_service_client"><div class="pagination-nav__sublabel">下一篇</div><div class="pagination-nav__label">CS Client<!-- --> »</div></a></div></nav></div></div><div class="col col--3"><div class="tableOfContents_vrFS thin-scrollbar"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#cscache架构" class="table-of-contents__link"><strong>CSCache架构</strong></a><ul><li><a href="#需要解决的问题" class="table-of-contents__link"><strong>需要解决的问题</strong></a></li><li><a href="#11-内存结构需要解决的问题" class="table-of-contents__link">1.1. 内存结构需要解决的问题:</a></li><li><a href="#12-加载与解析需要解决的问题" class="table-of-contents__link">1.2 加载与解析需要解决的问题:</a></li><li><a href="#13-metric和清理机制需要解决的问题" class="table-of-contents__link">1.3 Metric和清理机制需要解决的问题:</a></li></ul></li><li><a href="#contextcache架构" class="table-of-contents__link"><strong>ContextCache架构</strong></a></li><li><a href="#contextcache存储结构设计" class="table-of-contents__link"><strong>ContextCache存储结构设计</strong></a></li><li><a href="#contextcache-uml类图设计" class="table-of-contents__link"><strong>ContextCache UML类图设计</strong></a></li><li><a href="#contextcache-时序图" class="table-of-contents__link"><strong>ContextCache 时序图</strong></a></li><li><a href="#keyword解析逻辑" class="table-of-contents__link"><strong>KeyWord解析逻辑</strong></a></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container"><div class="row footer__links"><div class="col footer__col"><div class="footer__title">Linkis</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/zh-CN/docs/latest/introduction">文档</a></li><li class="footer__item"><a class="footer__link-item" href="/zh-CN/faq/main">FAQ</a></li><li class="footer__item"><a href="https://github.com/apache/incubator-linkis/releases" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>版本<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li></ul></div><div class="col footer__col"><div class="footer__title">社区</div><ul class="footer__items"><li class="footer__item"><a href="https://github.com/apache/incubator-linkis" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>GitHub<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li><li class="footer__item"><a href="https://github.com/apache/incubator-linkis/issues" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>Issue Tracker<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li><li class="footer__item"><a href="https://github.com/apache/incubator-linkis/pulls" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>Pull Requests<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li></ul></div><div class="col footer__col"><div class="footer__title">订阅邮件组</div><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/zh-CN/community/how-to-subscribe">如何订阅</a></li><li class="footer__item"><a href="mailto:dev-subscribe@linkis.apache.org" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>订阅邮件<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li><li class="footer__item"><a href="https://lists.apache.org/list.html?dev@linkis.apache.org" target="_blank" rel="noopener noreferrer" class="footer__link-item"><span>邮件归档<svg width="13.5" height="13.5" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_wgqa"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></span></a></li></ul></div></div><div class="footer__bottom text--center"><div class="footer__copyright"><div style="text-align: left;">
<div>
<p style="font-family: Avenir-Medium;font-size: 14px;color: #999;line-height: 20px;">Apache Linkis (incubating) is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.</p>
</div>
<div style="border-top: 1px solid #ccc;min-height: 60px;line-height: 20px;text-align: center;font-family: Avenir-Medium;font-size: 14px;color: #999;display: flex;align-items: center;"><span>Copyright © 2019-2020 The Apache Software Foundation. Apache Linkis, Linkis, and its feather logo are trademarks of The Apache Software Foundation.</span></div>
</div></div></div></div></footer></div>
<script src="/zh-CN/assets/js/runtime~main.14d5df0c.js"></script>
<script src="/zh-CN/assets/js/main.5a9c4743.js"></script>
</body>
</html>