flowmachine.core.server.cache_cleanup¶
main¶
main()
watch_and_shrink_cache¶
watch_and_shrink_cache(*, flowdb_connection: 'Connection', pool: concurrent.futures._base.Executor, sleep_time: int = 86400, timeout: Optional[int] = 600, loop: bool = True, size_threshold: int = None, dry_run: bool = False, protected_period: Optional[int] = None) -> None
Background task to periodically trigger a shrink of the cache.
Parameters¶
-
flowdb_connection
:Connection
Flowdb connection to check dates on
-
pool
:concurrent.futures._base.Executor
Executor to run the date check with
-
sleep_time
:int
, default86400
Number of seconds to sleep for between checks
-
timeout
:typing.Optional
, default600
Seconds to wait for a cache shrink to complete before cancelling it
-
loop
:bool
, defaultTrue
Set to false to return after the first check
-
size_threshold
:int
, defaultNone
Optionally override the maximum cache size set in flowdb.
-
dry_run
:bool
, defaultFalse
Set to true to just report the objects that would be removed and not remove them
-
protected_period
:typing.Optional
, defaultNone
Optionally specify a number of seconds within which cache entries are excluded. If None, the value stored in cache.cache_config will be used.Set to a negative number to ignore cache protection completely.
Returns¶
None