"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[1635],{8453:(e,n,r)=>{r.d(n,{R:()=>i,x:()=>s});var t=r(6540);const l={},a=t.createContext(l);function i(e){const n=t.useContext(a);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function s(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(l):e.components||l:i(e.components),t.createElement(a.Provider,{value:n},e.children)}},8779:(e,n,r)=>{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>t,toc:()=>o});const t=JSON.parse('{"id":"XXTLanControl.lua/kvdb/dict/clear","title":"Clear Dictionary (LCC.kvdb.dict.clear)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/kvdb/dict/clear.md","sourceDirName":"XXTLanControl.lua/kvdb/dict","slug":"/XXTLanControl.lua/kvdb/dict/clear","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/clear","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":90,"frontMatter":{"sidebar_position":90},"sidebar":"tutorialSidebar","previous":{"title":"Delete A Key (LCC.kvdb.dict.delete)","permalink":"/docs/en/XXTLanControl.lua/kvdb/dict/delete"},"next":{"title":"Queue APIs","permalink":"/docs/en/XXTLanControl.lua/kvdb/queue/"}}');var l=r(4848),a=r(8453);const i={sidebar_position:90},s="Clear Dictionary (LCC.kvdb.dict.clear)",c={},o=[{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,a.R)(),...e.components};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(n.header,{children:(0,l.jsx)(n.h1,{id:"clear-dictionary-lcckvdbdictclear",children:"Clear Dictionary (LCC.kvdb.dict.clear)"})}),"\n",(0,l.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:"values, err = LCC.kvdb.dict.clear(name, timeout?)\n"})}),"\n",(0,l.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["name",(0,l.jsx)(n.br,{}),"\n","String. Dictionary name (non-empty, max ",(0,l.jsx)(n.code,{children:"256"})," bytes)."]}),"\n",(0,l.jsxs)(n.li,{children:["timeout",(0,l.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,l.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,l.jsxs)(n.ul,{children:["\n",(0,l.jsxs)(n.li,{children:["values",(0,l.jsx)(n.br,{}),"\n","Table. Snapshot of key/value pairs before clearing; returns an empty table when the dictionary was already empty, or ",(0,l.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,l.jsxs)(n.li,{children:["err",(0,l.jsx)(n.br,{}),"\n","String or ",(0,l.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,l.jsxs)(n.blockquote,{children:["\n",(0,l.jsxs)(n.p,{children:["Clears every key in the dictionary and returns a snapshot of the previous entries.",(0,l.jsx)(n.br,{}),"\n","Useful when you need a backup of the previous contents before reset."]}),"\n"]}),"\n",(0,l.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,l.jsx)(n.pre,{children:(0,l.jsx)(n.code,{className:"language-lua",children:'local values, err = LCC.kvdb.dict.clear("cache")\nif values then\n    local count = 0\n    for _ in pairs(values) do count = count + 1 end\n    LCC.log(1, "Cache cleared", count)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,a.R)(),...e.components};return n?(0,l.jsx)(n,{...e,children:(0,l.jsx)(d,{...e})}):d(e)}}}]);