Skip to content

flowmachine.core.server.cache_cleanup

main

main()
Source: flowmachine/core/server/cache_cleanup.py

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
Source: flowmachine/core/server/cache_cleanup.py

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, default 86400

    Number of seconds to sleep for between checks

  • timeout: typing.Optional, default 600

    Seconds to wait for a cache shrink to complete before cancelling it

  • loop: bool, default True

    Set to false to return after the first check

  • size_threshold: int, default None

    Optionally override the maximum cache size set in flowdb.

  • dry_run: bool, default False

    Set to true to just report the objects that would be removed and not remove them

  • protected_period: typing.Optional, default None

    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