You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ Features
51
51
* Local caching using pickle files.
52
52
* Cross-machine caching using MongoDB.
53
53
* Thread-safety.
54
-
* **Per-call freshness threshold:** Specify a maximum age for cached values per call.
54
+
* **Per-call max age:** Specify a maximum age for cached values per call.
55
55
56
56
Cachier is **NOT**:
57
57
@@ -234,7 +234,7 @@ Per-function call arguments
234
234
235
235
Cachier also accepts several keyword arguments in the calls of the function it wraps rather than in the decorator call, allowing you to modify its behaviour for a specific function call.
236
236
237
-
**Freshness Threshold (max_age)**
237
+
**Max Age (max_age)**
238
238
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
239
239
You can specify a maximum allowed age for a cached value on a per-call basis using the `max_age` keyword argument. If the cached value is older than this threshold, a recalculation is triggered. This is in addition to the `stale_after` parameter set at the decorator level; the strictest (smallest) threshold is enforced.
240
240
@@ -247,11 +247,11 @@ You can specify a maximum allowed age for a cached value on a per-call basis usi
247
247
defadd(a, b):
248
248
return a + b
249
249
250
-
# Use a per-call freshness threshold:
250
+
# Use a per-call max age:
251
251
result = add(1, 2, max_age=timedelta(seconds=10)) # Only use cache if value is <10s old
252
252
253
253
**How it works:**
254
-
- The effective freshness threshold is the minimum of `stale_after` (from the decorator) and `max_age` (from the call).
254
+
- The effective max age threshold is the minimum of `stale_after` (from the decorator) and `max_age` (from the call).
255
255
- If the cached value is older than this threshold, a new calculation is triggered and the cache is updated.
0 commit comments