In-memory key/value store with multiple backends
In-memory key/value store with a plugin architecture. Ships with Memory, SQLite, Badger (BadgerDB), and InMemory backends. Supports glob + prefix listing.
composer require sugarcraft/sugar-skate
use SugarCraft\Skate\{Database, Store};
$db = new Database(new \SugarCraft\Skate\Backend\MemoryStore());
$store = $db->store('my-app');
$store->set('user:1', 'Alice', ['role' => 'admin']);
echo $store->get('user:1'); // 'Alice'
foreach ($store->list('user:*') as $key => $value) {
echo "$key => $value\n";
}
| Class | Method | Description |
|---|---|---|
| Database | new(backend) | Create database with backend |
| Database | store(name) | Get named store |
| Store | set(key, value, meta) | Set a key-value pair |
| Store | get(key) | Get value by key |
| Store | delete(key) | Delete a key |
| Store | list(pattern) | List keys matching pattern |
| MemoryStore | new() | In-memory backend |
| SqliteStore | new(path) | SQLite backend |
VHS-recorded GIFs of every example shipped with the library. Regenerated automatically on every push that touches the source.