Skip to Content

@jumentix/key-value-storage

Reusable key-value storage adapters for Jumentix services.

Included:

  • IKeyValueStorageClient contracts
  • InMemoryKeyValueStorageClient
  • RedisKeyValueStorageClient
  • compileKeyValueStorageClient environment-driven selector

This package is designed for multi-service reuse and avoids per-service adapter duplication.

Responsibility in context

  • Stack layer: persistence / infrastructure adapter
  • Owns: key/value port + InMemory/Redis adapters
  • Used with: mutex-service, backend composition
  • Not responsible for: SQL/document repos, IndexedDB (Cana), HTTP SDKs

Try it in the browser

In-memory adapter (browser mock of the same contract):

In-memory key/value

Cache UI preferences for the Task list with the same service-result shape used by package adapters.

const client = api.createInMemory();
await client.connect();

await client.set('ui:selected-category', {
  id: 'work',
  name: 'Work',
  visibleTaskIds: ['task-1', 'task-3']
});
await client.set('ui:last-sort', 'priority-desc');

const selectedCategory = await client.get('ui:selected-category');
const lastSort = await client.get('ui:last-sort');
await client.del('ui:last-sort');
const deletedSort = await client.get('ui:last-sort');
await client.disconnect();

return {
  selectedCategory: selectedCategory.result,
  lastSort: lastSort.result,
  deletedSort: deletedSort.result
};

Full documentation

See the consumer usage guide.