152
14
console.log('Count elements');
15
assert(db.count_all == 2);
16
17
console.log('Read key back');
18
assert(db.get('John') === '123-456-789');
19
20
console.log('Iterate through the phonebook');
21
db.get_all((k, v) => console.log(` name: ${k}, number: ${v}`));
22
23
console.log('Remove one record');
24
db.remove('John');
25
26
console.log('Lookup of removed record');
27
assert(!db.exists('John'));
28
29
console.log('Stopping engine');
30
db.stop();
The goal of higher-level pmemkv language bindings is to make programming
persistent memory even easier and to provide a convenient tool for developers of cloud
software.
Summary
In this chapter, we have shown how a familiar key-value data store is an easy way for the
broader cloud software developer audience to use persistent memory and directly access
the data in place. The modular design, flexible engine API, and integration with many
of the most popular cloud programming languages make pmemkv an intuitive choice
for cloud-native software developers. As an open source and lightweight library, it can
easily be integrated into existing applications to immediately start taking advantage of
persistent memory.
Some of the pmemkv engines are implemented using libpmemobj-cpp that we
described in Chapter 8. The implementation of such engines provides real-world
examples for developers to understand how to use PMDK (and related libraries) in
applications.
Chapter 9 pmemkv: a persistent in- memory key-value store
Précédent

- 177/457

Suivant