diff --git a/docs/engines.md b/docs/engines.md index fd1c164eba359dc234260dfee8902a1c21d74f90..652514d92f92453a44f8e755463482edaf45b76d 100644 --- a/docs/engines.md +++ b/docs/engines.md @@ -41,17 +41,22 @@ This is an exact recreation of 0x0.st's algorithm, so I'll also steal their grap 0 256.0 512.0 MiB ``` + The numbers are a little different, depending on how your config looks, but it works the same. +```python3 +stat = os.stat(os.path.join(config['UPLOAD_FOLDER'], f)) + systime = time.time() + age = timedelta(seconds = systime - stat.st_mtime).days + maxage = mind + (-maxd + mind) * (stat.st_size / maxs - 1) ** 3 + if age >= maxage: + delete_file(f) +``` + +## Engine Mode 3 (Hybrid 'Popularity' Based) + +Files are deleted on a aggregate score based on size and popularity (large, popular files are kept alive longer, vs unpopular files most likely just used once) - ```python3 - stat = os.stat(os.path.join(config['UPLOAD_FOLDER'], f)) - systime = time.time() - age = timedelta(seconds = systime - stat.st_mtime).days - maxage = mind + (-maxd + mind) * (stat.st_size / maxs - 1) ** 3 - if age >= maxage: - delete_file(f) - ``` +## Engine Mode 4 (Lazy-Hybrid 'Popularity' Based) -3. Hybrid 'popularity' deletion - Files are deleted on a aggregate score based on size and popularity (large, popular files are kept alive longer, vs unpopular files most likely just used once) -4. Lazy-Hybrid 'popularity' deletion - Files are deleted on size AND last view, depending on what comes last (small files stay the same, long files have potential to stay alive longer) \ No newline at end of file +Files are deleted on size AND last view, depending on what comes last (small files stay the same, long files have potential to stay alive longer)