class LastSeenTracker
THROTTLE = 5.minutes
PENDING_KEY = "pending:last_seen".freeze
class << self
def touch(user_id, at: Time.current)
module RequestStore
def self.store
Thread.current[:request_store] ||= {}
end
def self.fetch(key)
package api
import "net/http"
func ETag(w http.ResponseWriter, r *http.Request, etag string) bool {
w.Header().Set("ETag", etag)
package pricecache
import (
"context"
"sync"
class BatchLoader {
constructor(batchFn, { cacheKeyFn = (k) => k } = {}) {
this.batchFn = batchFn;
this.cacheKeyFn = cacheKeyFn;
this.cache = new Map();
this.queue = [];
import functools
import threading
import time
from collections import OrderedDict