This directory contains examples for pmemkv-java. Examples use various pmemkv engines (e.g. vsmap or cmap) - if example does not work, please verify if engine is enabled in pmemkv.
Examples can be built and executed, e.g.:
mvn package
PMEM_IS_PMEM_FORCE=1 java -ea -Xms1G -jar StringExample/target/StringExample-*-jar-with-dependencies.jarIt's a basic example, where both (key and value) are String objects.
It's an example, where key and values are a binary data.
As in the name - it has mixed types: keys are String objects and values are binary data.
It's more complex one - it uses persistent engine (cmap) to store pictures in pmemkv. Keys are String, values are BufferedImage.
Load pictures in the png format from the directory specified by the InputDir environment variable to new pmemkv datastore of size (in bytes) specified by PmemkvSize and display all pictures stored in this datastore.
PmemkvPath=/dev/shm/file PmemkvSize=10000000 InputDir=/path/to/directory/with/png/files PMEM_IS_PMEM_FORCE=1 java -ea -Xms1G -jar PicturesExample/target/PicturesExample-*-jar-with-dependencies.jarDisplay pictures already stored in the pmemkv datastore:
PmemkvPath=/dev/shm/file PMEM_IS_PMEM_FORCE=1 java -ea -Xms1G -jar PicturesExample/target/PicturesExample-*-jar-with-dependencies.jarAdd new pictures to already existing pmemkv datastore and display all pictures stored in this datastore.
PmemkvPath=/dev/shm/file InputDir=/path/to/directory/with/png/files PMEM_IS_PMEM_FORCE=1 java -ea -Xms1G -jar PicturesExample/target/PicturesExample-*-jar-with-dependencies.jar