title: how to efficiently call a func after X hours?
body: <p>I know I can do like this:</p>
  
  <pre><code>func randomFunc() {
      // do stuff
      go destroyObjectAfterXHours(4, "idofobject")
      // do other stuff
  }
  
  func destroyObjectAfterXHours(hours int, id string) {
      time.Sleep(hours * time.Hour)
      destroyObject(id)
  }
  </code></pre>
  
  <p>but if we imagine <code>destroyObjectAfterXHours</code> is called a million times within a few minutes, this solution will be very bad.</p>
  
  <p>I was hoping someone could share a more efficient solution to this problem.</p>
  
  <p>I've been thinking about a potential solution where destruction time and object id was stored somewhere, and then there would be one func that would traverse through the list every X minutes, destroy the objects that had to be destroyed and remove their id and time info from wherever that info was stored. Would this be a good solution?</p>
  
  <p>I worry it would also be bad solution since you will then have to traverse through a list with millions of items all the time, and then have to efficiently remove some of the items, etc. </p>