{"repo":"Yiling-J/theine","free":true,"listed":false,"github":"https://github.com/Yiling-J/theine","clone":"git clone https://github.com/Yiling-J/theine.git","description":"high performance in-memory cache","language":"Python","stars":429,"topics":["cache","memory","python","django","ttl"],"license":"BSD-3-Clause","category":"api-integrations-sdks","readme_excerpt":"Theine High performance in-memory cache inspired by Caffeine. - High performance Rust core - High hit ratio with adaptive W-TinyLFU eviction policy - Expired data are removed automatically using hierarchical timer wheel - Fully typed - Thread-safe with Free-Threading support (tested on Python 3.13.6t) - Django cache backend Theine V2 Migration Guide Theine V2 is a major refactor and rewrite of V1, focused on thread safety and scalability. Below are the key changes: Cache Class and Memoize Decorator In V2, the Cache class and Memoize decorator now accept capacity as the first parameter. We have simplified the design by consolidating to a single policy: adaptive W-Tinylfu. Old: New: Making Cache.get return explicit existence status The Cache.get method now returns a tuple (value, exists) instead of only the value. This makes it explicit whether the requested key was found in the cache. In the old API, a missing key returned None (or a provided default value), which could cause ambiguity if None was also a valid cached value. Old: New: Renaming timeout to ttl The timeout parameter in the Cache class’s set method has been renamed to ttl (Time-to-Live). This is more commonly used in caching and is clearer in meaning. In V1, the term timeout was used for consistency with Django, but ttl is now the preferred naming convention in V2. The Django adapter settings still uses TIMEOUT for compatibility. Old: New: Thread Safety by Default In V2, both the Cache class and the Memoize decorat","default_branch":null,"files":null,"tree":[],"storefront":"/r/Yiling-J","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Yiling-J/theine/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}