[{"data":1,"prerenderedAt":742},["ShallowReactive",2],{"navigation":3,"index":151},[4,29,56,79,94,121,128,144],{"title":5,"path":6,"stem":7,"children":8,"icon":27,"defaultOpen":28},"Getting Started","\u002Fgetting-started","1.getting-started\u002F1.index",[9,12,17,22],{"title":10,"path":6,"stem":7,"icon":11},"Introduction","i-lucide-book-open",{"title":13,"path":14,"stem":15,"icon":16},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":18,"path":19,"stem":20,"icon":21},"Redis setup","\u002Fgetting-started\u002Fredis-setup","1.getting-started\u002F3.redis-setup","i-lucide-database",{"title":23,"path":24,"stem":25,"icon":26},"Quickstart","\u002Fgetting-started\u002Fquickstart","1.getting-started\u002F4.quickstart","i-lucide-zap","i-lucide-rocket",true,{"title":30,"icon":31,"path":32,"stem":33,"children":34,"page":55},"Concepts","i-lucide-lightbulb","\u002Fconcepts","2.concepts",[35,40,45,50],{"title":36,"path":37,"stem":38,"icon":39},"Keys","\u002Fconcepts\u002Fkeys","2.concepts\u002F1.keys","i-lucide-key-round",{"title":41,"path":42,"stem":43,"icon":44},"Strict vs lax","\u002Fconcepts\u002Fstrict-vs-lax","2.concepts\u002F2.strict-vs-lax","i-lucide-scale",{"title":46,"path":47,"stem":48,"icon":49},"Comparators","\u002Fconcepts\u002Fcomparators","2.concepts\u002F3.comparators","i-lucide-git-compare",{"title":51,"path":52,"stem":53,"icon":54},"Errors","\u002Fconcepts\u002Ferrors","2.concepts\u002F4.errors","i-lucide-triangle-alert",false,{"title":57,"path":58,"stem":59,"children":60,"icon":63},"Counters","\u002Fcounters","3.counters\u002F1.index",[61,64,69,74],{"title":62,"path":58,"stem":59,"icon":63},"Overview","i-lucide-hash",{"title":65,"path":66,"stem":67,"icon":68},"StrictCounter","\u002Fcounters\u002Fstrict-counter","3.counters\u002F2.strict-counter","i-lucide-target",{"title":70,"path":71,"stem":72,"icon":73},"LaxCounter","\u002Fcounters\u002Flax-counter","3.counters\u002F3.lax-counter","i-lucide-wind",{"title":75,"path":76,"stem":77,"icon":78},"Conditional & batch operations","\u002Fcounters\u002Fconditional-and-batch","3.counters\u002F4.conditional-and-batch","i-lucide-layers",{"title":80,"path":81,"stem":82,"children":83,"icon":85},"Instance-aware counters","\u002Finstance-aware-counters","4.instance-aware-counters\u002F1.index",[84,86,90],{"title":62,"path":81,"stem":82,"icon":85},"i-lucide-network",{"title":87,"path":88,"stem":89,"icon":68},"StrictInstanceAwareCounter","\u002Finstance-aware-counters\u002Fstrict","4.instance-aware-counters\u002F2.strict",{"title":91,"path":92,"stem":93,"icon":73},"LaxInstanceAwareCounter","\u002Finstance-aware-counters\u002Flax","4.instance-aware-counters\u002F3.lax",{"title":95,"path":96,"stem":97,"children":98,"icon":100},"Locks","\u002Flocks","5.locks\u002F1.index",[99,101,106,111,116],{"title":62,"path":96,"stem":97,"icon":100},"i-lucide-lock",{"title":102,"path":103,"stem":104,"icon":105},"Mutex","\u002Flocks\u002Fmutex","5.locks\u002F2.mutex","i-lucide-lock-keyhole",{"title":107,"path":108,"stem":109,"icon":110},"RwLock","\u002Flocks\u002Frwlock","5.locks\u002F3.rwlock","i-lucide-book-lock",{"title":112,"path":113,"stem":114,"icon":115},"Lock options","\u002Flocks\u002Foptions","5.locks\u002F4.options","i-lucide-sliders-horizontal",{"title":117,"path":118,"stem":119,"icon":120},"Guard state & errors","\u002Flocks\u002Fguard-state","5.locks\u002F5.guard-state","i-lucide-shield-alert",{"title":122,"path":123,"stem":124,"children":125,"icon":127},"Rate limiting","\u002Frate-limiting","6.rate-limiting\u002F1.index",[126],{"title":122,"path":123,"stem":124,"icon":127},"i-lucide-gauge",{"title":129,"icon":130,"path":131,"stem":132,"children":133,"page":55},"Reference","i-lucide-book-marked","\u002Freference","7.reference",[134,139],{"title":135,"path":136,"stem":137,"icon":138},"Feature flags","\u002Freference\u002Ffeature-flags","7.reference\u002F1.feature-flags","i-lucide-flag",{"title":140,"path":141,"stem":142,"icon":143},"API reference","\u002Freference\u002Fapi","7.reference\u002F2.api","i-lucide-file-code",{"title":145,"path":146,"stem":147,"children":148,"icon":150},"Changelog","\u002Fchangelog","8.changelog\u002F1.index",[149],{"title":145,"path":146,"stem":147,"icon":150},"i-lucide-scroll",{"id":152,"title":153,"body":154,"description":153,"extension":734,"meta":735,"navigation":28,"path":736,"seo":737,"stem":740,"__hash__":741},"landing\u002Findex.md","",{"type":155,"value":156,"toc":732},"minimark",[157,564,642,713,728],[158,159,165,171,184,202,229],"u-page-hero",{"className":160,"orientation":164},[161,162,163],"dark:bg-gradient-to-b","from-neutral-900","to-neutral-950","horizontal",[166,167,168],"template",{"v-slot:top":153},[169,170],"hero-background",{},[166,172,173],{"v-slot:title":153},[174,175,176,177,183],"p",{},"Distributed primitives for Rust, ",[178,179,182],"span",{"className":180},[181],"text-primary","backed by Redis",".",[166,185,186],{"v-slot:description":153},[174,187,188,189,193,194,197,198,201],{},"distkit gives you the building blocks distributed services keep reinventing - counters, instance-aware counters, locks, and rate limiting - behind small, async APIs that mirror the ",[190,191,192],"code",{},"std"," and ",[190,195,196],{},"tokio"," types you already know. ",[190,199,200],{},"#![forbid(unsafe_code)]",", no panics in library code.",[166,203,204,212,222],{"v-slot:links":153},[205,206,209],"u-button",{"size":207,"to":6,"trailing-icon":208},"xl","i-lucide-arrow-right",[174,210,211],{},"Get started",[205,213,219],{"size":207,"to":214,"color":215,"target":216,"variant":217,"icon":218},"https:\u002F\u002Fgithub.com\u002Fdev-davexoyinbo\u002Fdistkit","neutral","_blank","ghost","i-simple-icons-github",[174,220,221],{},"GitHub",[205,223,226],{"size":207,"to":224,"color":215,"target":216,"trailing-icon":225,"variant":217},"https:\u002F\u002Fcrates.io\u002Fcrates\u002Fdistkit","i-lucide-external-link",[174,227,228],{},"crates.io",[230,231,236,284],"u-card",{"className":232},[233,234,235],"divide-y","divide-neutral-200\u002F60","dark:divide-neutral-800\u002F60",[237,238,241],"prose-pre",{"code":239,"filename":240},"[dependencies]\ndistkit = \"0.5\"\n","Cargo.toml",[242,243,246],"pre",{"className":244,"code":239,"filename":240,"language":245,"meta":153,"style":153},"language-toml shiki shiki-themes material-theme-lighter github-light github-dark","toml",[190,247,248,263],{"__ignoreMap":153},[178,249,252,256,260],{"class":250,"line":251},"line",1,[178,253,255],{"class":254},"sP7_E","[",[178,257,259],{"class":258},"sbgvK","dependencies",[178,261,262],{"class":254},"]\n",[178,264,266,270,273,277,281],{"class":250,"line":265},2,[178,267,269],{"class":268},"su5hD","distkit ",[178,271,272],{"class":254},"=",[178,274,276],{"class":275},"sjJ54"," \"",[178,278,280],{"class":279},"s_sjI","0.5",[178,282,283],{"class":275},"\"\n",[237,285,288],{"code":286,"filename":287},"use distkit::{DistkitRedisKey, counter::{StrictCounter, CounterOptions, CounterTrait}};\n\nlet conn = redis::Client::open(\"redis:\u002F\u002F127.0.0.1\u002F\")?\n    .get_connection_manager().await?;\nlet prefix = DistkitRedisKey::try_from(\"my_app\".to_string())?;\n\nlet counter = StrictCounter::new(CounterOptions::new(prefix, conn));\nlet key = DistkitRedisKey::try_from(\"page_views\".to_string())?;\ncounter.inc(&key, 1).await?;\n","main.rs",[242,289,292],{"className":290,"code":286,"filename":287,"language":291,"meta":153,"style":153},"language-rust shiki shiki-themes material-theme-lighter github-light github-dark","rust",[190,293,294,338,343,386,410,449,454,494,529],{"__ignoreMap":153},[178,295,296,300,303,307,310,313,316,319,321,323,325,327,330,332,335],{"class":250,"line":251},[178,297,299],{"class":298},"sw1J6","use",[178,301,302],{"class":258}," distkit",[178,304,306],{"class":305},"smGrS","::",[178,308,309],{"class":254},"{",[178,311,312],{"class":258},"DistkitRedisKey",[178,314,315],{"class":254},",",[178,317,318],{"class":258}," counter",[178,320,306],{"class":305},[178,322,309],{"class":254},[178,324,65],{"class":258},[178,326,315],{"class":254},[178,328,329],{"class":258}," CounterOptions",[178,331,315],{"class":254},[178,333,334],{"class":258}," CounterTrait",[178,336,337],{"class":254},"}};\n",[178,339,340],{"class":250,"line":265},[178,341,342],{"emptyLinePlaceholder":28},"\n",[178,344,346,350,353,355,358,360,363,365,369,372,375,378,380,383],{"class":250,"line":345},3,[178,347,349],{"class":348},"sbsja","let",[178,351,352],{"class":268}," conn ",[178,354,272],{"class":305},[178,356,357],{"class":258}," redis",[178,359,306],{"class":305},[178,361,362],{"class":258},"Client",[178,364,306],{"class":305},[178,366,368],{"class":367},"sGLFI","open",[178,370,371],{"class":254},"(",[178,373,374],{"class":275},"\"",[178,376,377],{"class":279},"redis:\u002F\u002F127.0.0.1\u002F",[178,379,374],{"class":275},[178,381,382],{"class":254},")",[178,384,385],{"class":305},"?\n",[178,387,389,392,395,398,400,404,407],{"class":250,"line":388},4,[178,390,391],{"class":305},"    .",[178,393,394],{"class":367},"get_connection_manager",[178,396,397],{"class":254},"()",[178,399,183],{"class":305},[178,401,403],{"class":402},"sVHd0","await",[178,405,406],{"class":305},"?",[178,408,409],{"class":254},";\n",[178,411,413,415,418,420,423,425,428,430,432,435,437,439,442,445,447],{"class":250,"line":412},5,[178,414,349],{"class":348},[178,416,417],{"class":268}," prefix ",[178,419,272],{"class":305},[178,421,422],{"class":258}," DistkitRedisKey",[178,424,306],{"class":305},[178,426,427],{"class":367},"try_from",[178,429,371],{"class":254},[178,431,374],{"class":275},[178,433,434],{"class":279},"my_app",[178,436,374],{"class":275},[178,438,183],{"class":305},[178,440,441],{"class":367},"to_string",[178,443,444],{"class":254},"())",[178,446,406],{"class":305},[178,448,409],{"class":254},[178,450,452],{"class":250,"line":451},6,[178,453,342],{"emptyLinePlaceholder":28},[178,455,457,459,462,464,467,469,472,474,477,479,481,483,486,488,491],{"class":250,"line":456},7,[178,458,349],{"class":348},[178,460,461],{"class":268}," counter ",[178,463,272],{"class":305},[178,465,466],{"class":258}," StrictCounter",[178,468,306],{"class":305},[178,470,471],{"class":367},"new",[178,473,371],{"class":254},[178,475,476],{"class":258},"CounterOptions",[178,478,306],{"class":305},[178,480,471],{"class":367},[178,482,371],{"class":254},[178,484,485],{"class":268},"prefix",[178,487,315],{"class":254},[178,489,490],{"class":268}," conn",[178,492,493],{"class":254},"));\n",[178,495,497,499,502,504,506,508,510,512,514,517,519,521,523,525,527],{"class":250,"line":496},8,[178,498,349],{"class":348},[178,500,501],{"class":268}," key ",[178,503,272],{"class":305},[178,505,422],{"class":258},[178,507,306],{"class":305},[178,509,427],{"class":367},[178,511,371],{"class":254},[178,513,374],{"class":275},[178,515,516],{"class":279},"page_views",[178,518,374],{"class":275},[178,520,183],{"class":305},[178,522,441],{"class":367},[178,524,444],{"class":254},[178,526,406],{"class":305},[178,528,409],{"class":254},[178,530,532,535,537,540,542,545,548,550,554,556,558,560,562],{"class":250,"line":531},9,[178,533,534],{"class":268},"counter",[178,536,183],{"class":305},[178,538,539],{"class":367},"inc",[178,541,371],{"class":254},[178,543,544],{"class":305},"&",[178,546,547],{"class":268},"key",[178,549,315],{"class":254},[178,551,553],{"class":552},"srdBf"," 1",[178,555,382],{"class":254},[178,557,183],{"class":305},[178,559,403],{"class":402},[178,561,406],{"class":305},[178,563,409],{"class":254},[565,566,567,572,577],"u-page-section",{},[166,568,569],{"v-slot:title":153},[174,570,571],{},"One toolkit, four primitives",[166,573,574],{"v-slot:description":153},[174,575,576],{},"Each primitive is its own opt-in feature. Pull in only what you use - the core counters ship by default.",[166,578,579,591,602,627],{"v-slot:features":153},[580,581,582,586],"u-page-feature",{"icon":63,"to":58},[166,583,584],{"v-slot:title":153},[174,585,57],{},[166,587,588],{"v-slot:description":153},[174,589,590],{},"Strict counters are atomic per call; lax counters buffer in memory and flush on an interval for sub-microsecond writes. Conditional and batch operations on both.",[580,592,593,597],{"icon":85,"to":81},[166,594,595],{"v-slot:title":153},[174,596,80],{},[166,598,599],{"v-slot:description":153},[174,600,601],{},"Each instance owns a slice of the total. The cumulative is the sum of live instances, and dead instances are cleaned up automatically via heartbeats.",[580,603,604,609],{"icon":100,"to":96},[166,605,606],{"v-slot:title":153},[174,607,608],{},"Distributed locks",[166,610,611],{"v-slot:description":153},[174,612,613,614,616,617,619,620,623,624,183],{},"Redis-backed ",[190,615,102],{}," and writer-preferring ",[190,618,107],{}," that mirror ",[190,621,622],{},"tokio::sync",". RAII guards, background lease renewal, and an awaitable ",[190,625,626],{},"release()",[580,628,629,633],{"icon":127,"to":123},[166,630,631],{"v-slot:title":153},[174,632,122],{},[166,634,635],{"v-slot:description":153},[174,636,637,638,641],{},"Sliding-window rate limiting via the trypema crate, re-exported under ",[190,639,640],{},"distkit::trypema"," with local, Redis, and hybrid providers.",[565,643,646,651],{"className":644},[645],"dark:bg-neutral-950",[166,647,648],{"v-slot:title":153},[174,649,650],{},"Built to be predictable",[166,652,653,672,684,696],{"v-slot:features":153},[580,654,656,661],{"icon":655},"i-lucide-shield-check",[166,657,658],{"v-slot:title":153},[174,659,660],{},"Safe by default",[166,662,663],{"v-slot:description":153},[174,664,665,667,668,671],{},[190,666,200],{}," and no panics in library code. Errors surface through one ",[190,669,670],{},"DistkitError"," enum.",[580,673,674,679],{"icon":44},[166,675,676],{"v-slot:title":153},[174,677,678],{},"Strict or lax, your call",[166,680,681],{"v-slot:description":153},[174,682,683],{},"Choose immediate consistency when accuracy is critical, or buffered writes when throughput matters. Same trait, different guarantees.",[580,685,686,691],{"icon":26},[166,687,688],{"v-slot:title":153},[174,689,690],{},"Atomic where it counts",[166,692,693],{"v-slot:description":153},[174,694,695],{},"Strict operations execute Lua scripts so a single Redis round-trip is atomic - no read-modify-write races across instances.",[580,697,699,704],{"icon":698},"i-lucide-recycle",[166,700,701],{"v-slot:title":153},[174,702,703],{},"Self-cleaning background tasks",[166,705,706],{"v-slot:description":153},[174,707,708,709,712],{},"Flush and lease-renewal tasks hold ",[190,710,711],{},"Weak"," references and stop on their own when the owning value is dropped.",[565,714,718],{"className":715},[161,716,717],"from-neutral-950","to-neutral-900",[719,720,725],"u-page-c-t-a",{":links":721,"className":722,"description":723,"title":724},"[{\"label\":\"Get started\",\"to\":\"\u002Fgetting-started\",\"trailingIcon\":\"i-lucide-arrow-right\"},{\"label\":\"View on GitHub\",\"to\":\"https:\u002F\u002Fgithub.com\u002Fdev-davexoyinbo\u002Fdistkit\",\"target\":\"_blank\",\"variant\":\"subtle\",\"icon\":\"i-simple-icons-github\"}]",[645],"Install the crate, point it at Redis, and reach for the primitive you need.","Ready to add distkit?",[726,727],"stars-bg",{},[729,730,731],"style",{},"html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sw1J6, html code.shiki .sw1J6{--shiki-light:#F76D47;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .srdBf, html code.shiki .srdBf{--shiki-light:#F76D47;--shiki-default:#005CC5;--shiki-dark:#79B8FF}",{"title":153,"searchDepth":251,"depth":265,"links":733},[],"md",{},"\u002F",{"title":738,"description":739},"distkit - Distributed systems primitives for Rust","distkit is a Rust toolkit of distributed systems primitives backed by Redis - strict and lax counters, instance-aware counters, distributed locks, and rate limiting.","index","3h2xb-PTwQjs7K4B1_J9yIGuYOiL_S82K1O5d0JJELw",1781569580971]