A Ruby library for object-hash mapping with Redis, providing a simple way to store and query objects.
Ohm is a Ruby library for Object-Hash Mapping (OHM) with Redis, enabling developers to store and query Ruby objects in Redis without migrations or external schemas. It provides a simple, performant way to map objects to Redis data structures like hashes, sets, and lists, making it ideal for applications leveraging Redis as a primary datastore.
Ruby developers building applications that use Redis for persistence and need a lightweight, schema-less object mapping solution without the overhead of traditional ORMs.
Ohm offers a minimalistic and fast approach to object persistence in Redis, with features like atomic counters, associations, and indexing out of the box, while avoiding the complexity of migrations and external schema definitions.
Object-Hash Mapping for Redis
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Ohm eliminates migrations and external schema definitions, allowing direct storage of Ruby objects in Redis without upfront design, as emphasized in its philosophy.
Counters support atomic increment/decrement, and set/list operations are performed immediately upon method calls, ensuring real-time data consistency for features like voting.
Declaring indices on attributes enables fast searches using find and filter methods, such as combine and union, for efficient querying without SQL.
The track feature allows associating arbitrary Redis keys with an object's lifecycle, enabling advanced data management like append-only logs without manual cleanup.
Querying relies on pre-defined indices and set operations, which may not support ad-hoc or complex filtering compared to SQL-based ORMs, limiting dynamic data retrieval.
Ohm lacks built-in validation, callbacks, or migrations, requiring developers to implement these separately or use extensions, adding overhead for common tasks.
Heavy dependence on Redis limits portability; switching datastores would require significant code changes due to Ohm's tight integration with Redis data structures.
Ohm 2 introduces breaking compatibility with previous versions, as noted in the README, which can complicate upgrades for existing applications without thorough testing.