Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Ruby
  3. Redis-Objects

Redis-Objects

Artistic-2.0Ruby

A Ruby library that maps Redis data types directly to Ruby objects with atomic operations.

GitHubGitHub
2.1k stars231 forks0 contributors

What is Redis-Objects?

Redis::Objects is a Ruby library that maps Redis data types (like counters, lists, sets, and hashes) directly to Ruby objects. It provides a high-level, Ruby-friendly API for performing atomic operations on Redis structures, solving concurrency issues that arise when using Redis with traditional ORM wrappers. It integrates seamlessly with Ruby models (e.g., ActiveRecord) while preserving Redis's atomicity guarantees.

Target Audience

Ruby developers building applications that require high-concurrency atomic operations on shared data, especially those using Redis for caching, counters, or real-time data structures. It's ideal for teams integrating Redis with Rails, Sinatra, or other Ruby frameworks.

Value Proposition

Developers choose Redis::Objects because it maintains Redis's atomic operations, preventing race conditions that occur with ORM-like wrappers. It offers a clean Ruby API, automatic marshaling of complex data, and easy integration with existing models, making Redis usage more intuitive and less error-prone.

Overview

Map Redis types directly to Ruby objects

Use Cases

Best For

  • Adding atomic counters to ActiveRecord models (e.g., vote counts, view tracking)
  • Implementing distributed locks for batch jobs across multiple servers
  • Storing and manipulating Redis lists, sets, or sorted sets with Ruby-like syntax
  • Managing real-time leaderboards or rankings with sorted sets
  • Handling high-concurrency operations like inventory management or rate limiting
  • Integrating Redis data structures directly into Ruby classes without low-level Redis commands

Not Ideal For

  • Projects requiring complex multi-key Redis transactions or Lua scripting for custom logic
  • Teams using polyglot tech stacks where Ruby is not the primary language
  • Applications planning frequent migrations between different data stores (e.g., Redis to Memcached)

Pros & Cons

Pros

Atomic Operation Guarantee

Preserves Redis's atomicity for data types like counters and lists, preventing race conditions as emphasized in the 'Atomic Rant' philosophy section.

Seamless Model Integration

Easily integrates with ORMs like ActiveRecord by scoping keys to instance IDs, shown in the Team class example with redis_lock and counters.

Comprehensive Data Types

Maps all core Redis types to Ruby objects with familiar semantics, such as array-like operations for lists and set unions/intersections.

Flexible Serialization Options

Supports custom serializers like JSON or YAML and optional compression, detailed in the 'Custom serialization' section.

Cons

Breaking Upgrade Path

Version 2.0 introduced significant changes like renaming 'lock' to 'redis_lock' and key prefix issues, requiring code updates and manual data migration.

Redis Lock-in

Tightly couples application logic to Redis, making it difficult to switch to alternative data stores without extensive refactoring of data access layers.

Complex Nested Class Handling

Nested classes (e.g., Dog::Behavior) suffer from key naming collisions that require manual migration and configuration changes, as warned in the README.

Frequently Asked Questions

Quick Stats

Stars2,095
Forks231
Contributors0
Open Issues11
Last commit4 months ago
CreatedSince 2009

Tags

#orm-integration#redis#data-structures#ruby-gem#distributed-locks#key-value-store#concurrency#ruby

Built With

R
Ruby
R
Redis

Included in

Ruby14.1k
Auto-fetched 1 day ago

Related Projects

MongoidMongoid

The Official Ruby Object Mapper for MongoDB

Stars3,917
Forks1,380
Last commit11 days ago
ROMROM

Data mapping and persistence toolkit for Ruby

Stars2,112
Forks166
Last commit4 months ago
OhmOhm

Object-Hash Mapping for Redis

Stars1,385
Forks163
Last commit3 years ago
Hanami::ModelHanami::Model

Ruby persistence framework with entities and repositories

Stars447
Forks146
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub