"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[669],{7651:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>c});const r=JSON.parse('{"id":"XXTLanControl.lua/kvdb/queue/count","title":"Count Value Occurrences (LCC.kvdb.queue.count)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/queue/count.md","sourceDirName":"XXTLanControl.lua/kvdb/queue","slug":"/XXTLanControl.lua/kvdb/queue/count","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/count","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":100,"frontMatter":{"sidebar_position":100},"sidebar":"tutorialSidebar","previous":{"title":"Clear Entire Queue (LCC.kvdb.queue.clear)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/clear"},"next":{"title":"Retrieve Queue Length (LCC.kvdb.queue.size)","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/size"}}');var u=t(4848),s=t(8453);const o={sidebar_position:100},i="Count Value Occurrences (LCC.kvdb.queue.count)",l={},c=[{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 a(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,s.R)(),...e.components};return(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(n.header,{children:(0,u.jsx)(n.h1,{id:"count-value-occurrences-lcckvdbqueuecount",children:"Count Value Occurrences (LCC.kvdb.queue.count)"})}),"\n",(0,u.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,u.jsx)(n.pre,{children:(0,u.jsx)(n.code,{className:"language-lua",children:"count, err = LCC.kvdb.queue.count(name, value, timeout?)\n"})}),"\n",(0,u.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,u.jsxs)(n.ul,{children:["\n",(0,u.jsxs)(n.li,{children:["name",(0,u.jsx)(n.br,{}),"\n","String. Queue name (non-empty, max ",(0,u.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,u.jsxs)(n.li,{children:["value",(0,u.jsx)(n.br,{}),"\n","String. Value to count within the queue (must be valid UTF-8)."]}),"\n",(0,u.jsxs)(n.li,{children:["timeout",(0,u.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,u.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,u.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,u.jsxs)(n.ul,{children:["\n",(0,u.jsxs)(n.li,{children:["count",(0,u.jsx)(n.br,{}),"\n","Number. Occurrence count; ",(0,u.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,u.jsxs)(n.li,{children:["err",(0,u.jsx)(n.br,{}),"\n","String or ",(0,u.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,u.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,u.jsxs)(n.blockquote,{children:["\n",(0,u.jsxs)(n.p,{children:["Counts how many times the given value appears in the queue (server-side).",(0,u.jsx)(n.br,{}),"\n","Useful for rate limiting or queue monitoring."]}),"\n"]}),"\n",(0,u.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,u.jsx)(n.pre,{children:(0,u.jsx)(n.code,{className:"language-lua",children:'local cnt, err = LCC.kvdb.queue.count("pending", "timeout")\nif cnt then\n    print("Tasks pending retry:", cnt)\nend\n'})})]})}function d(e={}){const{wrapper:n}={...(0,s.R)(),...e.components};return n?(0,u.jsx)(n,{...e,children:(0,u.jsx)(a,{...e})}):a(e)}},8453:(e,n,t)=>{t.d(n,{R:()=>o,x:()=>i});var r=t(6540);const u={},s=r.createContext(u);function o(e){const n=r.useContext(s);return r.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(u):e.components||u:o(e.components),r.createElement(s.Provider,{value:n},e.children)}}}]);