Implement a class-based cache that supports get(key, now) and put(key, value, ttl, now) with capacity-limited LRU eviction and expiration. Each entry expires at time now + ttl; expired entries must behave as missing, and when capacity is full, the least recently used non-expired entry should be evicted. Design the cache so operations are thread-safe while keeping lock contention low.
def run_lru_ttl_cache(capacity, operations):