https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • k

    kulotskinakalbo

    03/07/2023, 1:24 PM
    thanks
  • b

    BUTTΞRKΞKS1000

    03/07/2023, 4:16 PM
    How can i cache requests from a worker, that updates every 3 minutes?
  • d

    Dani Foldi

    03/07/2023, 4:21 PM
    Are you looking for something different tot setting the expiry time to be the end of your 3 minute interval?
  • b

    BUTTΞRKΞKS1000

    03/07/2023, 4:23 PM
    Every 3 min i store something in kv and i thought i can cache it and only refresh it like every 3 min does this work?
  • d

    Dani Foldi

    03/07/2023, 4:24 PM
    absolutely, bearing in mind cache is per colo and you can read from KV multiple times
  • b

    BUTTΞRKΞKS1000

    03/07/2023, 4:25 PM
    yes, can you tell me how to do this?
  • d

    Dani Foldi

    03/07/2023, 4:29 PM
    I recommend using
    flareutils
    by Ali (thanks for the updated docs page), check out `BetterKV`: https://flareutils.pages.dev/betterkv/ For the cache TTL in the get (& potentially put), use
    Math.ceil(Date.now()/(180*1000))*180*1000-Date.now()
    to have it kept until the next 3 minute interval
  • h

    HardAtWork

    03/07/2023, 4:35 PM
    I think I broke the JS again…
  • a

    AlexDicy

    03/07/2023, 7:47 PM
    Hey there, I'm a little out of the loop with the development of Workers. How is the support for TCP connections going? Can I connect to a mongodb cluster via TCP?
  • t

    Tom Sherman

    03/07/2023, 7:49 PM
    It landed in workerd at the end of last year https://github.com/cloudflare/workerd/pull/162 I'm not sure it's available yet on cloudflare
  • t

    Tom Sherman

    03/07/2023, 7:51 PM
    The flag is
    tcp_sockets_support
  • a

    AlexDicy

    03/07/2023, 7:51 PM
    Thanks
  • e

    Erisa | Support Engineer

    03/07/2023, 7:56 PM
    Still in active development (and largely developed in public now, as noted by above), you can sign up to the waitlist for using on Cloudflare here https://www.cloudflare.com/database-connectors-early-access/
  • a

    AlexDicy

    03/07/2023, 7:57 PM
    Fantastic, I'm signing up now, thank you
  • a

    ArunP

    03/07/2023, 9:27 PM
    A question on workers. We use workers to host static sites (for failover pages). When we point cloudflare load balancer at the worker in same cloudflare account, we get error 1014/cname cross user banned. There used to some flag that we needed to ask the support team to switch, so that our load balancer can point at the worker (and we had put the worker in a different cloudflare account). I fail to recollect what that setting was to request it. Does anyone have similar experience or know how to do that. Thanks.
  • u

    Unsmart | Tech debt

    03/07/2023, 9:28 PM
    Umm you shouldnt use load balancers at all with workers cloudflare automatically manages the load 🤔
  • a

    ArunP

    03/07/2023, 9:30 PM
    we use the load balancer to load balance to our origin servers in normal operation, but in case our datacenters go down and the cloudflare load balancer detects that, we would like cloudflare load balancer to point at a self hosted static page (which we host on a worker)
  • p

    Pato

    03/07/2023, 10:27 PM
    when using webcrypto in getting this error
    Error: ReferenceError, window is not defined, undefined
  • p

    Pato

    03/07/2023, 10:39 PM
    does the fs library works in a CFW?
  • c

    Cyb3r-Jok3

    03/07/2023, 10:43 PM
    It does not as there is no file system on workers
  • a

    Alisson Acioli

    03/07/2023, 11:57 PM
    Does anyone know of an even cheaper alternative than KV to work with Worker? Something that is on the edge too. I have a lot of reading mainly and with KV it would be very expensive.
  • t

    Tom Sherman

    03/08/2023, 12:03 AM
    wow, what kind of scale are you at where KV reads are becoming expensive 😮
  • c

    Cyb3r-Jok3

    03/08/2023, 12:06 AM
    If you have high reads then you can try using the cache api in front. Still requires worker being called but leads to less KV reads
  • a

    Alisson Acioli

    03/08/2023, 12:08 AM
    Not that it's high value, it's low. But I was looking at an even cheaper alternative. We have an average of 60 to 100 million requests per month going through workers today and this year I still believe we will hit 500 million. There are data that we would like to use KV to store and remove legacy dependencies that use VM and here at the company we are trying to find and calculate alternatives.
  • a

    Advany

    03/08/2023, 8:48 AM
    have you looked at Analytics engine beta? but difficult to recommend something without knowing the use case?
  • u

    Unsmart | Tech debt

    03/08/2023, 8:53 AM
    edge based 50 cents per million reads is wildly low cost I can't really imagine anything being cheaper than that
  • u

    Unsmart | Tech debt

    03/08/2023, 8:54 AM
    500 million reads is $250
  • a

    Advany

    03/08/2023, 8:56 AM
    fast, reliable, and low cost... I don't even know how Cloudflare does this....
  • c

    Callixd

    03/08/2023, 10:50 AM
    Hello everyone, I'm trying to grasp the concept of cache in workers. Is the cache api only able to cache responses from fetch calls done through the worker, or can it cache the actual worker response?
  • c

    Callixd

    03/08/2023, 10:51 AM
    Is it:
    Copy code
    client side -> worker call -> worker response (can i cache that using the cache api?) -> client receives response
1...232623272328...2509Latest