https://discord.cloudflare.com logo
Join Discord
Powered by
# durable-objects
  • c

    ckoeninger

    12/30/2022, 6:24 PM
    similar to the 128mb limit for stateless workers
  • m

    muslax

    12/30/2022, 7:18 PM
    Ah great.
  • h

    hannes

    12/31/2022, 11:06 AM
    Interesting. But doesn't invoking KV , even when "hitting the cache" (as this is transparent to the Developer) always incur costs, while using cache API directly doesn't?
  • z

    zegevlier

    12/31/2022, 11:10 AM
    Yes, that's true
  • d

    Dani Foldi

    12/31/2022, 11:30 AM
    This is what @HardAtWork 's BetterKV wrapper does under the hood: check out
    flareutils
    on npm docs here: https://flareutils.pages.dev/classes/BetterKV
  • p

    p0

    12/31/2022, 10:08 PM
    I am trying to create an API in cloudflare workers. I want to bill my API based on how many requests the subscriber uses. For example, Person A signs up for a plan that allows 100 requests per day. How would I prevent Person A from going above that limit? Essentially, how do I keep track of a simple +1 increment without really expensive KV writes? External Databases also aren't an option because that eliminates the entire reason I'm using edge functions.
  • s

    sks

    01/01/2023, 4:01 AM
    You need Durable objects.
  • p

    p0

    01/01/2023, 4:02 AM
    already got my answer in #779390076219686943 but thanks!
  • p

    p0

    01/01/2023, 4:02 AM
    I ended up using analytics engine
  • s

    sks

    01/01/2023, 4:02 AM
    Okay. How’d you implement that ?
  • p

    p0

    01/01/2023, 4:03 AM
    not implemented yet
  • p

    p0

    01/01/2023, 4:03 AM
    but it seems fairly simple
  • p

    p0

    01/01/2023, 4:03 AM
    https://discord.com/channels/595317990191398933/779390076219686943/1058881949147607140
  • s

    sks

    01/01/2023, 4:03 AM
    Cause I’m trying to do the same thing. But I don’t know about the Analytics engine approach
  • p

    p0

    01/01/2023, 4:04 AM
    read analytics engine docs & https://discord.com/channels/595317990191398933/779390076219686943/1058881949147607140
  • u

    Unsmart | Tech debt

    01/01/2023, 4:04 AM
    Well with hard limits it's going to be impossible to use AE because of rate limits on the read end.
  • u

    Unsmart | Tech debt

    01/01/2023, 4:04 AM
    Which is why I suggested DO > AE
  • p

    p0

    01/01/2023, 4:04 AM
    with "hard limits"
  • p

    p0

    01/01/2023, 4:05 AM
    you can allow a little bit of wiggle room
  • p

    p0

    01/01/2023, 4:05 AM
    at least in my case
  • u

    Unsmart | Tech debt

    01/01/2023, 4:06 AM
    Well even a soft limit because you still need to read the total number of requests they've done and you can't query AE often.
  • p

    p0

    01/01/2023, 4:06 AM
    what's the read limit speed on the AE
  • p

    p0

    01/01/2023, 4:06 AM
    in fact, you don't even need to use WHERE
  • u

    Unsmart | Tech debt

    01/01/2023, 4:06 AM
    1200 reads every 5 minutes
  • p

    p0

    01/01/2023, 4:07 AM
    you can just use an SQL search that finds all things that are above 500 requests
  • p

    p0

    01/01/2023, 4:07 AM
    no need to use a ton of WHERE requests
  • p

    p0

    01/01/2023, 4:08 AM
    every second, just do this
  • p

    p0

    01/01/2023, 4:08 AM
    correct me if I'm wrong ofc
  • u

    Unsmart | Tech debt

    01/01/2023, 4:08 AM
    Having many users you will easily reach that 1200 count. Especially since not all data might fit on one page
  • p

    p0

    01/01/2023, 4:08 AM
    "reads", as in?
1...467468469...567Latest