NAME
Airlock::Store::Memory - In-process Airlock store for tests and single-process apps
VERSION
version 0.001
SYNOPSIS
my $memory = Airlock::Store::Memory->new;
my $airlock = Airlock->new( store => $memory->as_subs, ... );
DESCRIPTION
The store Airlock uses when it is given none. Rows live in a hash inside the process, so it is right for tests and for an app with exactly one process, and wrong for anything that forks workers: used from another process than the one that created it, it croaks.
It is also the reference for the store contract: four operations, of which only "update" has to be atomic.
insert
$memory->insert( \%row );
Stores a copy of the row. Croaks when the hash or a defined user_code is already taken.
find
my $row = $memory->find( hash => $hash );
my $row = $memory->find( user_code => 'BCDFGHJK' );
A copy of the matching row, or nothing.
update
$memory->update( $hash, 'pending', { state => 'approved' } ) or return;
Applies the changes only if the row is still in $from_state. Returns true when it did. A value that is a reference to a number is added to the field instead of replacing it: { factor_failures => \1 }. This condition is what makes redeeming a request happen once.
purge
my $removed = $memory->purge( time );
Removes every row whose expires is before the given time.
as_subs
my $store = $memory->as_subs;
The four operations as the hash of coderefs Airlock takes as store.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-airlock/issues.
IRC
Join #kubernetes 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 <torsten@raudssus.de> 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.