Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Official GE price lookup [Auto-updating]


    Calculus

    Recommended Posts

    It's unneccesary to flush the entire cache every 10 minutes. What if one of the prices was only looked up one minute ago?

     

    It'd be better to add an updatedAt field to the result and then users will know how old it is and your price updater can simply loop through the map periodically and refresh (or remove) prices that are more than 10 minutes old.

    Link to comment
    Share on other sites

    It's unneccesary to flush the entire cache every 10 minutes. What if one of the prices was only looked up one minute ago?

     

    It'd be better to add an updatedAt field to the result and then users will know how old it is and your price updater can simply loop through the map periodically and refresh (or remove) prices that are more than 10 minutes old.

    Not really m8, the entire point of this was to "Auto-Update" (check the title). It does exactly what it says it does, and won't update the prices until something is re-queued. I don't think you understand the concept of the code, or didn't read it fully, so here's an example of how it works:

     

    Example:

    1. I lookup an item.
    2. I lookup the same item 9 minutes later
      1. The item is not re-updated
    3. The elapsed time has now passed 10 minutes
      1. Nothing happens, it doesn't matter. No need to waste CPU/network time
    4. I lookup the same item 18 minutes later
      1. The item is now refreshed.

     

    EDIT: If you don't queue a new item, it won't be refreshed. It also doesn't refresh the entire cache, it simply flushes them, which means that the NEXT time they're queued, it will be updated. This code is pretty damn efficient.

     

    Also, if you want to add your own "updatedAt" feature or whatever, go for it. This is just a snippet for the public to use/expand on, not something you're paying for, or I need to keep updated.

    Link to comment
    Share on other sites

    Not really m8, the entire point of this was to "Auto-Update" (check the title). It does exactly what it says it does, and won't update the prices until something is re-queued. I don't think you understand the concept of the code, or didn't read it fully, so here's an example of how it works:

     

    Example:

    1. I lookup an item.
    2. I lookup the same item 9 minutes later
      1. The item is not re-updated
    3. The elapsed time has now passed 10 minutes
      1. Nothing happens, it doesn't matter. No need to waste CPU/network time
    4. I lookup the same item 18 minutes later
      1. The item is now refreshed.

     

    EDIT: If you don't queue a new item, it won't be refreshed. It also doesn't refresh the entire cache, it simply flushes them, which means that the NEXT time they're queued, it will be updated. This code is pretty damn efficient.

     

    Also, if you want to add your own "updatedAt" feature or whatever, go for it. This is just a snippet for the public to use/expand on, not something you're paying for, or I need to keep updated.

     

    I understand how it works, I was suggesting something like this to avoid completely invalidating the cache every 10 minutes:

     

    See this diff:

    https://www.diffchecker.com/hw6upmhe

    Link to comment
    Share on other sites

    • 3 years later...

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.