NAME

Langertha::Role::KeepAlive - Role for engines that support keep-alive duration

VERSION

version 0.503

keep_alive

keep_alive => '5m'
keep_alive => -1     # keep forever
keep_alive => 300    # seconds

Controls how long the engine keeps the model loaded in memory after a request. Accepts a duration string with a unit such as 5m or 1h, or a plain number of seconds (300 or '300'; a negative number such as -1 keeps the model loaded forever). A plain number, also when given as a string, is sent as a JSON number; a duration string stays a string. When not set, the engine uses its own default.

See also no_keep_alive for explicitly unloading the model after each request.

no_keep_alive

no_keep_alive => 1

When true, the model is unloaded from memory immediately after each request. Equivalent to setting keep_alive => 0 but more explicit.

get_keep_alive

Returns the effective keep-alive value: the number 0 if no_keep_alive is set, the keep_alive value if provided (a plain number as a number, see "keep_alive"), or undef if neither is set (letting the engine use its default).

Composing this role advertises the keep_alive capability, so callers can dispatch on $engine->supports('keep_alive') — see Langertha::Role::Capabilities.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <getty@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus https://raudssus.de/.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.