vsitnikov / php-shared-memory
Shared memory php library
dev-master
2019-11-08 15:47 UTC
Requires
- php: ^7.2
- ext-json: *
- ext-shmop: *
- psr/log: ^1.1
- vsitnikov/php-semaphore-emulate: @dev
Requires (Dev)
- phpunit/phpunit: ^7
This package is not auto-updated.
Last update: 2025-04-19 15:34:03 UTC
README
Attention! This project is in development, do not use it, everything can change completely.
Initialization:
use vsitnikov\SharedMemory\AbstractSharedMemoryClient as mem;
require_once "../vendor/autoload.php";
$file = "/path/to/exists/file";
// A simple option, only the file is indicated, if the data is already there, they will be saved, as well as locks
mem::init(["memory_key" => $file]);
// Same
mem::init(["memory_key" => $file, "init_rule" => mem::INIT_DATA_SAFE]);
// Forced deletion of all data and unlocking
mem::init(["memory_key" => $file, "init_rule" => mem::INIT_DATA_CLEAN]);
// Saving all data, regardless of whether something is saved or not. Attention! Reading data from an uninitialized repository will result in an error
mem::init(["memory_key" => $file, "init_rule" => mem::INIT_DATA_IGNORE]);
Set value:
mem::set("/path/to/key", "value");
Get value:
# Get value
mem::get("/path/to/key");
# Get dir
mem::get("/path/to");
# Get dir recursive
mem::get("/path");