1
0
forked from bot/app
LiteyukiBot/assets/dev_shared_memory.html-Bq1TPb1D.js

6 lines
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{_ as n,r as o,o as s,c as r,b as e,d as t,a as i,e as p}from"./app-D1iI42LG.js";const c={},l=p(`<h1 id="简介" tabindex="-1"><a class="header-anchor" href="#简介"><span>简介</span></a></h1><p>相比于普通进程通信,内存共享使得代码编写更加简洁,轻雪框架提供了一个内存共享通信的接口,你可以通过<code>shared_memory</code>模块实现内存共享通信 内存共享是线程安全的,你可以在多个线程中读写共享内存,线程锁会自动保护共享内存的读写操作</p><h2 id="快速开始" tabindex="-1"><a class="header-anchor" href="#快速开始"><span>快速开始</span></a></h2><ul><li>在任意进程中均可使用</li></ul><div class="language-python line-numbers-mode" data-ext="py" data-title="py"><pre class="language-python"><code><span class="token keyword">from</span> liteyuki<span class="token punctuation">.</span>comm<span class="token punctuation">.</span>storage <span class="token keyword">import</span> shared_memory
shared_memory<span class="token punctuation">.</span><span class="token builtin">set</span><span class="token punctuation">(</span><span class="token string">&quot;key&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;value&quot;</span><span class="token punctuation">)</span> <span class="token comment"># 设置共享内存</span>
value <span class="token operator">=</span> shared_memory<span class="token punctuation">.</span>get<span class="token punctuation">(</span><span class="token string">&quot;key&quot;</span><span class="token punctuation">)</span> <span class="token comment"># 获取共享内存</span>
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,5),m={href:"https://github.com/LiteyukiStudio/LiteyukiBot/blob/main/liteyuki/comm/storage.py",target:"_blank",rel:"noopener noreferrer"};function d(u,h){const a=o("ExternalLinkIcon");return s(),r("div",null,[l,e("ul",null,[e("li",null,[t("源代码:"),e("a",m,[t("liteyuki/comm/storage.py"),i(a)])])])])}const k=n(c,[["render",d],["__file","dev_shared_memory.html.vue"]]),_=JSON.parse('{"path":"/dev/dev_shared_memory.html","title":"内存共享通信","lang":"zh-CN","frontmatter":{"title":"内存共享通信","icon":"exchange-alt","order":5,"category":"开发","description":"简介 相比于普通进程通信内存共享使得代码编写更加简洁轻雪框架提供了一个内存共享通信的接口你可以通过shared_memory模块实现内存共享通信 内存共享是线程安全的,你可以在多个线程中读写共享内存,线程锁会自动保护共享内存的读写操作 快速开始 在任意进程中均可使用 源代码liteyuki/comm/storage.py","head":[["meta",{"property":"og:url","content":"https://vuepress-theme-hope-docs-demo.netlify.app/dev/dev_shared_memory.html"}],["meta",{"property":"og:site_name","content":"LiteyukiBot 轻雪机器人"}],["meta",{"property":"og:title","content":"内存共享通信"}],["meta",{"property":"og:description","content":"简介 相比于普通进程通信内存共享使得代码编写更加简洁轻雪框架提供了一个内存共享通信的接口你可以通过shared_memory模块实现内存共享通信 内存共享是线程安全的,你可以在多个线程中读写共享内存,线程锁会自动保护共享内存的读写操作 快速开始 在任意进程中均可使用 源代码liteyuki/comm/storage.py"}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2024-08-16T16:18:06.000Z"}],["meta",{"property":"article:author","content":"远野千束"}],["meta",{"property":"article:modified_time","content":"2024-08-16T16:18:06.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"内存共享通信\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2024-08-16T16:18:06.000Z\\",\\"author\\":[{\\"@type\\":\\"Person\\",\\"name\\":\\"远野千束\\",\\"url\\":\\"https://sfkm.me\\"}]}"]]},"headers":[{"level":2,"title":"快速开始","slug":"快速开始","link":"#快速开始","children":[]}],"git":{"createdTime":1723825086000,"updatedTime":1723825086000,"contributors":[{"name":"snowy","email":"snowykami@outlook.com","commits":1}]},"readingTime":{"minutes":0.53,"words":159},"filePathRelative":"dev/dev_shared_memory.md","localizedDate":"2024年8月16日","autoDesc":true}');export{k as comp,_ as data};