Data-SimpleKV
view release on metacpan or search on metacpan
lib/Data/SimpleKV.pm view on Meta::CPAN
return 1;
}
# ææå½æ°ï¼èªå¨ä¿åæªä¿åçæ´æ¹
sub DESTROY {
my ($self) = @_;
if ($self->{dirty}) {
eval { $self->save() };
warn "Auto-save failed during destruction: $@" if $@;
}
}
1;
__END__
=head1 FILE STRUCTURE
The module stores data files in the following locations:
=over 4
=item * Primary location: /var/lib/simplekv/
=item * Fallback location: $HOME/.simplekv/
=item * Emergency fallback: /tmp/.simplekv/
=back
Files created:
=over 4
=item * {db_name}.db - The main data file (Storable binary format)
=back
File permissions are set to 0644 (readable by all, writable by owner).
=head1 MULTI-PROCESS SAFETY
The module uses file locking to ensure safe concurrent access:
=over 4
=item * Exclusive locks for writing during save operations
=item * Lock files prevent concurrent write operations
=back
Note: Data merging between processes is not supported. The last process
to call save() will overwrite previous changes.
=head1 UTF-8 SUPPORT
The module fully supports UTF-8 encoded strings for both keys and values.
All string data is properly encoded/decoded to ensure correct storage
and retrieval of international characters.
=head1 DEPENDENCIES
=over 4
=item * Storable - For binary serialization
=item * Fcntl - For file locking
=item * File::Path - For directory creation
=item * File::Spec - For cross-platform file paths
=item * Encode - For UTF-8 handling
=back
=head1 AUTHOR
Y Peng, C<< <ypeng at t-online.de> >>
=head1 LICENSE AND COPYRIGHT
This software is Copyright (c) 2025 by Y Peng.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
=cut
( run in 1.037 second using v1.01-cache-2.11-cpan-39bf76dae61 )