put#
Store a value under a key.
Synopsis#
$txn->put($db, $key, $value);
my $added = $txn->put($db, $key, $value, MDB_NOOVERWRITE);
Flags#
none - store, replacing the key’s value; in an
MDB_DUPSORTdatabase, add the value to the key’s values.MDB_NOOVERWRITE- store only a key not yet there.MDB_NODUPDATA- in anMDB_DUPSORTdatabase, store only a value the key does not hold yet.MDB_APPEND,MDB_APPENDDUP- the key (value) goes after all the others: a fast load of sorted data; out of order it croaksMDB_KEYEXIST.
What you get back#
True when stored, false when MDB_NOOVERWRITE or MDB_NODUPDATA found the key (value) already there.
Edge cases#
In a read transaction it croaks with LMDB’s
Permission denied.MDB_RESERVEis refused with a croak.When the data outgrows the environment’s
mapsizeit croaksMDB_MAP_FULL, and the transaction can only be aborted.
See also#
del- removes a key or one valuePeta::LMDB::Cursor-putat a cursor