{"id":23546,"library":"disklru","title":"disklru","description":"A disk-based LRU (Least Recently Used) cache for Python that stores cached data on disk, providing persistent caching across sessions. Current version 2.0.4 supports Python >=3.8, with a simple decorator and function-based API. Release cadence is irregular, with updates as needed.","status":"active","version":"2.0.4","language":"python","source_language":"en","source_url":"https://github.com/zackees/disklru","tags":["disklru","cache","lru","disk-cache","persistent-cache"],"install":[{"cmd":"pip install disklru","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"wrong":"from disklru import DiskLRU","symbol":"DiskLRUCache","correct":"from disklru import DiskLRUCache"}],"quickstart":{"code":"from disklru import DiskLRU\n\ncache = DiskLRU(capacity=10, cache_dir='/tmp/my_cache')\n@cache.cache()\ndef expensive_function(key):\n    return f'result for {key}'\n\nprint(expensive_function('a'))  # cached\n","lang":"python","description":"Create a disk-based LRU cache and use the decorator to cache function results."},"warnings":[{"fix":"Replace `from disklru import discache` with `from disklru import DiskLRU` and use `cache = DiskLRU(...); @cache.cache()`","message":"In version 2.0.0, the API changed significantly. The old `discache` function is removed. Use `DiskLRU` class with `@cache.cache()` decorator instead of `@discache()`. Also, the `lru_cache` decorator was added.","severity":"breaking","affected_versions":"<2.0.0 to >=2.0.0"},{"fix":"Delete the cache_dir or implement versioning in the cache key.","message":"The cache directory persists between runs. If you change the function logic, you must manually clear the cache directory to invalidate stale entries.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure all cached data can be serialized with pickle.","message":"Pickle is used for serialization, so cached objects must be picklable. Custom objects may fail.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2.0.4':26 '3.8':29 'across':22 'api':38 'base':5,37 'cach':10,15,21,48,52,55 'cadenc':40 'current':24 'data':16 'decor':33 'disk':4,18,51 'disk-bas':3 'disk-cach':50 'disklru':1,47 'function':36 'function-bas':35 'irregular':42 'least':7 'lru':6,49 'need':46 'persist':20,54 'persistent-cach':53 'provid':19 'python':12,28 'recent':8 'releas':39 'session':23 'simpl':32 'store':14 'support':27 'updat':44 'use':9 'version':25","created_at":"2026-05-01T08:08:20.460245+00:00","updated_at":"2026-05-01T08:08:20.460245+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.0.4","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/zackees/disklru","docs":null,"changelog":null,"pypi":"https://pypi.org/project/disklru/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}