"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[3734],{1925:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>i});const s=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/push_front","title":"Push To Queue Front (LCC.kvdb.queue.push_front)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/push_front.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/push_front","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/push_front","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":20,"frontMatter":{"sidebar_position":20},"sidebar":"tutorialSidebar","previous":{"title":"Queue APIs","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/"},"next":{"title":"Push To Queue Back (LCC.kvdb.queue.push_back)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/push_back"}}');var t=r(4848),u=r(8453);const o={sidebar_position:20},a="Push To Queue Front (LCC.kvdb.queue.push_front)",l={},i=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,u.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.header,{children:(0,t.jsx)(n.h1,{id:"push-to-queue-front-lcckvdbqueuepush_front",children:"Push To Queue Front (LCC.kvdb.queue.push_front)"})}),"\n",(0,t.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:"size, err = LCC.kvdb.queue.push_front(name, value, timeout?)\n"})}),"\n",(0,t.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["name",(0,t.jsx)(n.br,{}),"\n","String. Queue name (non-empty, max ",(0,t.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,t.jsxs)(n.li,{children:["value",(0,t.jsx)(n.br,{}),"\n","String, or a continuous string array. Strings must be valid UTF-8."]}),"\n",(0,t.jsxs)(n.li,{children:["timeout",(0,t.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,t.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsxs)(n.li,{children:["size",(0,t.jsx)(n.br,{}),"\n","Number. Queue length after the push; ",(0,t.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,t.jsxs)(n.li,{children:["err",(0,t.jsx)(n.br,{}),"\n","String or ",(0,t.jsx)(n.code,{children:"nil"}),". Error message when the call fails."]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,t.jsxs)(n.blockquote,{children:["\n",(0,t.jsxs)(n.p,{children:["Pushes an item onto the head of the queue.",(0,t.jsx)(n.br,{}),"\n","Batch pushes preserve array order. For example, ",(0,t.jsx)(n.code,{children:'{"a", "b"}'})," becomes the new head ",(0,t.jsx)(n.code,{children:"a, b, ..."}),".\nQueue names cannot be empty."]}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-lua",children:'local size, err = LCC.kvdb.queue.push_front("pending", "task#1")\nif size then\n    LCC.log(1, "Queue size", size)\nend\n\nlocal batch_size, batch_err = LCC.kvdb.queue.push_front("pending", {"task#2", "task#3"})\n'})})]})}function c(e={}){const{wrapper:n}={...(0,u.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(d,{...e})}):d(e)}},8453:(e,n,r)=>{r.d(n,{R:()=>o,x:()=>a});var s=r(6540);const t={},u=s.createContext(t);function o(e){const n=s.useContext(u);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:o(e.components),s.createElement(u.Provider,{value:n},e.children)}}}]);