tldr-pages / tldr-python-client

:snake: Python command-line client for tldr pages 📚
https://pypi.org/project/tldr/
MIT License
599 stars 95 forks source link

Use recent cache instead of always downloading #30

Closed pacohh closed 8 years ago

pacohh commented 8 years ago

I didn't like that I always had to wait for 1-3 seconds for the output of the client, so I changed it to load the pages from cache instead of always downloading them. The pages aren't often updated in the main repo, so I think it's alright to load from cache and only update them ever so often.

It's set so that by default it loads from cache, but only if the cache file isn't older than 24 hours. The loading from cache and the max cache age can be set with two new environment variables: TLDR_CACHE_ENABLED and TLDR_CACHE_MAX_AGE.

Reference #15 and #8

felixonmars commented 8 years ago

:+1: Thanks a lot!