Data-HashMap-Shared
view release on metacpan or search on metacpan
Sharding
my $map = Data::HashMap::Shared::II->new_sharded($path_prefix, $shards, $max_entries, ...);
Creates $shards independent maps (files "$path_prefix.0",
"$path_prefix.1", ...) behind a single handle, each with up to
$max_entries entries (total capacity is "$shards * $max_entries").
Per-key operations automatically route to the correct shard via hash
dispatch. Writes to different shards proceed in parallel with
independent locks.
All operations work transparently on sharded maps: "put", "get",
"remove", "exists", "add", "update", "swap", "take", "incr", "cas",
"get_or_set", "put_ttl", "touch", "persist", "set_ttl", "keys",
"values", "items", "to_hash", "set_multi" (method only), "get_multi"
(method only), "each", "pop", "shift", "drain", "clear",
"flush_expired", "flush_expired_partial", "size", "stats" (method only),
"reserve", and all diagnostic keywords.
Cursors chain across shards automatically. "cursor_seek" routes to the
correct shard based on key hash. $shards is rounded up to the next power
of 2.
lib/Data/HashMap/Shared.pm view on Meta::CPAN
=head2 Sharding
my $map = Data::HashMap::Shared::II->new_sharded($path_prefix, $shards, $max_entries, ...);
Creates C<$shards> independent maps (files C<$path_prefix.0>, C<$path_prefix.1>,
...) behind a single handle, each with up to C<$max_entries> entries
(total capacity is C<$shards * $max_entries>). Per-key operations automatically
route to the correct shard via hash dispatch. Writes to different shards
proceed in parallel with independent locks.
All operations work transparently on sharded maps: C<put>, C<get>, C<remove>,
C<exists>, C<add>, C<update>, C<swap>, C<take>, C<incr>, C<cas>,
C<get_or_set>, C<put_ttl>, C<touch>, C<persist>, C<set_ttl>, C<keys>,
C<values>, C<items>, C<to_hash>, C<set_multi> (method only),
C<get_multi> (method only), C<each>, C<pop>, C<shift>, C<drain>,
C<clear>, C<flush_expired>, C<flush_expired_partial>, C<size>,
C<stats> (method only), C<reserve>, and all diagnostic keywords.
Cursors chain across shards automatically. C<cursor_seek> routes to the
correct shard based on key hash. C<$shards> is rounded up to the next
power of 2.
* Do not compile and link xxhash.o as a separate object, as it is not useful.
*/
# define XXH_INLINE_ALL
# undef XXH_INLINE_ALL
/*!
* @brief Exposes the implementation without marking functions as inline.
*/
# define XXH_PRIVATE_API
# undef XXH_PRIVATE_API
/*!
* @brief Emulate a namespace by transparently prefixing all symbols.
*
* If you want to include _and expose_ xxHash functions from within your own
* library, but also want to avoid symbol collisions with other libraries which
* may also include xxHash, you can use @ref XXH_NAMESPACE to automatically prefix
* any public symbol from xxhash library with the value of @ref XXH_NAMESPACE
* (therefore, avoid empty or numeric values).
*
* Note that no change is required within the calling program as long as it
* includes `xxhash.h`: Regular symbol names will be automatically translated
* by this header.
( run in 2.099 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )