Skip to content

Instantly share code, notes, and snippets.

View firdavsDev's full-sized avatar
🪐
building

Davronbek SWE firdavsDev

🪐
building
View GitHub Profile
@firdavsDev
firdavsDev / cache_function.py
Created August 23, 2024 13:35
Python Function Caching
from functools import lru_cache, wraps
from time import monotonic
def lru_cache_with_ttl(maxsize=128, typed=False, ttl=60):
"""Least-recently used cache with time-to-live (ttl) limit."""
class Result:
__slots__ = ("value", "death")
@parmentf
parmentf / GitCommitEmoji.md
Last active July 17, 2025 08:30
Git Commit message Emoji