Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 43 lines (28 sloc) 2.272 kb
3fb42041 » whoahbot
2009-05-26 renamed back to dm-redis-adapter, fixed a bug with #update
1 h1. dm-redis-adapter
76c2c5c2 » whoahbot
2009-03-14 refactored to use the dm-core/next branch, a few rewrites of the inte…
2
a0c3ec50 » whoahbot
2009-05-26 Updating the readme
3 This is a <a href="http://datamapper.org">DataMapper</a> adapter for the <a href="http://github.com/antirez/redis/">Redis</a> key-value database.
ce8604bc » whoahbot
2009-03-19 update of the readme
4
1c3e1f6f » whoahbot
2009-05-29 Newer version of rubyredis.rb, updates to the Readme
5 Redis is a very fast key-value store with some interesting data structures added. You can have a key that is a SET, LIST, or a STRING 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: <a href="http://code.google.com/p/redis/">redis</a>. Redis is also a persistent data store, and can be used in large-scale environments with master-slave replication.
6
7 <a href="http://datamapper.org">DataMapper</a> is a brilliant ORM that is based on the <a href="http://www.martinfowler.com/eaaCatalog/identityMap.html">IdentityMap</a> 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.
8
e97d531f » whoahbot
2009-05-29 finishing up the readme
9 Marrying 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.
10
ce8604bc » whoahbot
2009-03-19 update of the readme
11 h1. Install
76c2c5c2 » whoahbot
2009-03-14 refactored to use the dm-core/next branch, a few rewrites of the inte…
12
7533c27b » whoahbot
2009-05-24 Moving to rubyredis client lib for now until it's merged in with redi…
13 Prerequisites:
1c3e1f6f » whoahbot
2009-05-29 Newer version of rubyredis.rb, updates to the Readme
14 * Redis:
15 ** <a href="http://code.google.com/p/redis/">Redis, v0.100</a>
b84fd9cb » whoahbot
2009-03-14 I suck at textile
16 * Gems:
23dd5c70 » whoahbot
2009-05-17 Updates to match changes with dm-next, now working against the shared…
17 ** <a href="http://github.com/datamapper/extlib">extlib</a>, dependency for dm-core
1c3e1f6f » whoahbot
2009-05-29 Newer version of rubyredis.rb, updates to the Readme
18 ** <a href="http://github.com/datamapper/dm-core/tree/next">dm-core</a> next branch
19
20
21 h1. Usage
22
23 Setup your adapter, define your models and properties:
24
25 <pre>
26 <code>
e97d531f » whoahbot
2009-05-29 finishing up the readme
27 require 'dm-core'
28 require 'dm_redis_adapter'
29
1c3e1f6f » whoahbot
2009-05-29 Newer version of rubyredis.rb, updates to the Readme
30 DataMapper.setup(:default, {:adapter => "redis"})
31
32 class Cafe
33 include DataMapper::Resource
34
35 property :id, Serial
36 property :name, Text
37 end
38
39 Cafe.create(:name => "Whoahbot's Caffienitorium")
40 </code>
41 </pre>
42
e97d531f » whoahbot
2009-05-29 finishing up the readme
43 Now you can use redis in a ORM style, and take advantage of all of the amazing things that DataMapper offers.
Something went wrong with that request. Please try again.