{"id":13747585,"url":"https://github.com/lightyrs/dm-redis-adapter","last_synced_at":"2025-05-09T09:30:30.326Z","repository":{"id":3002102,"uuid":"4020196","full_name":"lightyrs/dm-redis-adapter","owner":"lightyrs","description":"A DataMapper adapter for redis","archived":false,"fork":true,"pushed_at":"2012-06-05T20:06:09.000Z","size":236,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-15T12:17:26.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://whoahbot.com","language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sfeu/dm-redis-adapter","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightyrs.png","metadata":{"files":{"readme":"README.textile","changelog":null,"contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-13T20:57:38.000Z","updated_at":"2013-01-08T17:06:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lightyrs/dm-redis-adapter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightyrs%2Fdm-redis-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightyrs%2Fdm-redis-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightyrs%2Fdm-redis-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightyrs%2Fdm-redis-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightyrs","download_url":"https://codeload.github.com/lightyrs/dm-redis-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253226248,"owners_count":21874302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T06:01:34.352Z","updated_at":"2025-05-09T09:30:29.993Z","avatar_url":"https://github.com/lightyrs.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"h1. dm-redis-adapter\n\nThis is a \u003ca href=\"http://datamapper.org\"\u003eDataMapper\u003c/a\u003e adapter for the \u003ca href=\"http://redis.io/\"\u003eRedis\u003c/a\u003e key-value store.\n\nRedis is a very fast key-value store with some interesting data structures added, and oh so much more. You can have a key that is a SET, LIST, STRING or HASH that is binary safe. Data structures like SET and LIST allow for even more interesting things. Redis is a fabulous and fast engine for data structures, and you can read more about it here: \u003ca href=\"http://code.google.com/p/redis/\"\u003eredis\u003c/a\u003e. Redis is also a persistent data store, and can be used in large-scale environments with master-slave replication and consistent hashing on the client side. Redis makes everyone happy and has been known to cause sunshine to spontaneously break out in clouded areas.\n\n\u003ca href=\"http://datamapper.org\"\u003eDataMapper\u003c/a\u003e is a brilliant ORM that is based on the \u003ca href=\"http://www.martinfowler.com/eaaCatalog/identityMap.html\"\u003eIdentityMap\u003c/a\u003e pattern.  Usage of DataMapper resembles that of ActiveRecord, the popular ORM bundled with Ruby on Rails, but with some very important differences. A quote from the DM wiki: \"One row in the database should equal one object reference. Pretty simple idea. Pretty profound impact.\" Having an identity map allows for very efficient queries to the database, as well as interesting forms of lazy loading of attributes or associations.\n\nMarrying DataMapper to Redis allows for schema-less models, you can add fields at any time without having to create a migration.  DataMapper also allows us to store non-native Redis types in the db, like Date fields.\n\nh1. Upgrading\n\nPlease note that as of version 0.5.3 of the gem, the key names that are used for storage have changed and break compatibility with previous versions!\n\nh1. Changelog\n\n\n* v0.6.2  Fixes a problem with 'destroyed' objects (thanks @snovotny!)\n* v0.6.1  Fixes a problem with deleting an object and not having it deleted from an assosciation (thanks @sheur!)\n* v0.6.0  Refactor and change to the way that model names are stored in redis\n* v0.5.3  Support for inheritance via sfeu and ujifgc, this version *breaks compatibility* with previous versions of the gem\n* v0.4.0  Support for dm-core v1.1.0\n* v0.3.0  Updates to support ruby 1.9.2 (thanks arbarlow!)\n* v0.2.1  Fixes to sorting\n* v0.1.1  Update to redis-rb v2.0.0\n* v0.1    Update to store records as redis hash values\n* v0.0.11 Updates to support newer versions of the redis client, support for JSON datatypes\n\nh1. Install\n\nPrerequisites:\n* Redis:\n** \u003ca href=\"http://code.google.com/p/redis/\"\u003eRedis, \u003e= v2.2 series\u003c/a\u003e\n\nInstall the dm-redis-adapter:\n\u003cpre\u003e\n  \u003ccode\u003e\n    \u003e gem install dm-redis-adapter\n  \u003c/code\u003e\n\u003c/pre\u003e\n\nh1. Usage\n\nSetup your adapter, define your models and properties:\n\n\u003cpre\u003e\n  \u003ccode\u003e\n    require 'rubygems'\n    require 'dm-core'\n    require 'dm-redis-adapter'\n\n    DataMapper.setup(:default, {:adapter  =\u003e \"redis\"})\n\n    class Cafe\n      include DataMapper::Resource\n\n      property :id,     Serial\n      property :name,   Text\n    end\n\n    Cafe.finalize\n\n    Cafe.create(:name =\u003e \"Whoahbot's Caffienitorium\")\n  \u003c/code\u003e\n\u003c/pre\u003e\n\nNow you can use redis in a ORM style, and take advantage of all of the amazing things that DataMapper offers.\n\nIf you want to do finds on specific String fields, add an index:\n\n\u003cpre\u003e\n  \u003ccode\u003e\n    class Coffee\n      include DataMapper::Resource\n\n      property :id,            Serial\n      property :description,   String, :index =\u003e true\n    end\n\n    Coffee.create(:description =\u003e \"Notes of crude oil and sulphur\")\n    Coffee.first(:description =\u003e \"Notes of crude oil and sulphur\") # will now work\n  \u003c/code\u003e\n\u003c/pre\u003e\n\nValidations on unique fields are now supported through indices and dm-validations:\n\n\u003cpre\u003e\n  \u003ccode\u003e\n    class Crumblecake\n      include DataMapper::Resource\n      validates_is_unique :flavor\n\n      property :id,      Serial\n      property :flavor,  String, :index =\u003e true\n    end\n\n    Crumblecake.create(:flavor =\u003e \"snozzbler\")\n    Crumblecake.new(:flavor =\u003e \"snozzbler\").valid? # false (of course!  Who ever heard of a snozzbler crumblecake?)\n  \u003c/code\u003e\n\u003c/pre\u003e\n\nh1. Badass contributors\n\n* \u003ca href=\"http://github.com/aeden\"\u003eAnthony Eden (aeden)\u003c/a\u003e Gem cleanup, update to jeweler\n* \u003ca href=\"http://github.com/sr\"\u003eSimon Roset (sr)\u003c/a\u003e Fixes for edge dm-core\n* \u003ca href=\"http://github.com/cehoffman\"\u003eChris Hoffman (cehoffman)\u003c/a\u003e Fixes for Ruby 1.9, bundler for development deps, fixes for sorting\n* \u003ca href=\"http://github.com/bpo\"\u003ebrian p o'rourke (bpo)\u003c/a\u003e Updates for newer versions of redis client and DM JSON type support, move to hash storage\n* \u003ca href=\"http://github.com/arbarlow\"\u003eAlex Barlow (arbarlow)\u003c/a\u003e Fixes for ruby 1.9.2\n* \u003ca href=\"http://github.com/jof\"\u003eJonathan Lassoff (jof)\u003c/a\u003e Fixes to support textual keys\n* \u003ca href=\"http://github.com/sfeu\"\u003eSebastian Feuerstack (sfeu)\u003c/a\u003e Fixes to support inheritance\n* \u003ca href=\"http://github.com/sheur\"\u003eStephen Heuer (@sheur)\u003c/a\u003e Fixes to deleted assosciations\n* \u003ca href=\"http://github.com/sheur\"\u003eSteve Novotny (@snovotny)\u003c/a\u003e Fixing a bug with 'destroyed' objects\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightyrs%2Fdm-redis-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightyrs%2Fdm-redis-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightyrs%2Fdm-redis-adapter/lists"}