Skip to content

armgit / Aleph

Public Imported from GitHub
0

Give satellite imagery, terrain data, buildings, streetview photos to your LLM

Extend cache lifetime to one week

Belluxx483fcba9676c
diff --git a/docs/cli.md b/docs/cli.md
index 20537ef..b755639 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -52,7 +52,7 @@ For example, `--stops 10` requests ten positions along the street. Choose a view
If several results match, use `--match ID` to pick a place or `--route N` to pick a street branch.
> [!TIP]
-> Images and Photon results are cached for 24 hours. Geofabrik files are kept until refreshed. Use `--refresh` to fetch new data or `--cache-dir PATH` to choose the cache folder (default: `$XDG_CACHE_HOME/aleph` or `~/.cache/aleph`).
+> Images and Photon results are cached for one week. Geofabrik files are kept until refreshed. Use `--refresh` to fetch new data or `--cache-dir PATH` to choose the cache folder (default: `$XDG_CACHE_HOME/aleph` or `~/.cache/aleph`).
## Capture an area
diff --git a/src/common.py b/src/common.py
index 86811c7..786bb14 100644
--- a/src/common.py
+++ b/src/common.py
@@ -125,7 +125,7 @@ class Client:
class CachedClient(Client):
- """Cache successful quick-query responses for one day."""
+ """Cache successful quick-query responses for one week."""
def __init__(self, directory, *, refresh=False):
super().__init__(delay=1, cache_dir=directory, refresh=refresh)
@@ -137,7 +137,7 @@ class CachedClient(Client):
return super().get(address, **kwargs)
key = hashlib.sha256(address.encode()).hexdigest()
path = self.cache_dir / key
- if not self.refresh and path.is_file() and time.time() - path.stat().st_mtime < 86400:
+ if not self.refresh and path.is_file() and time.time() - path.stat().st_mtime < 7 * 24 * 60 * 60:
self.hits += 1
return path.read_bytes()
result = super().get(address, **kwargs)