Using Ampere for Super-Fast Data Caching Awesomeness

Post on 07-May-2015

333 views 2 download

transcript

USING AMPEREfor Super-Fast Data Caching Awesomeness

1

Tuesday, October 2, 12

HII’m Max. I work at Trunk Club. I build and fix stuff a lot. Like

motorcycles and junk.2

Tuesday, October 2, 12

WHAT’S AMPERE?

3

Tuesday, October 2, 12

YET ANOTHER ORMIt’s an object relational model (ORM) like ActiveRecord,

Mongoid, or DataMapper.

Ampere : Redis :: Mongoid : MongoDB :: ActiveRecord : SQL

Tuesday, October 2, 12

WHAT’S REDIS?

5

Tuesday, October 2, 12

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

6

Tuesday, October 2, 12

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

7

Tuesday, October 2, 12

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

• Supports more complex data structures like lists, sets, and hashes.

8

Tuesday, October 2, 12

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

• Supports more complex data structures like lists, sets, and hashes.

• Pub/sub event-driven magic.

9

Tuesday, October 2, 12

WHAT’S REDIS?

• Super-fast data cache, like memcached, but awesome.

•Durable. Your data’s still there even after a restart.

• Supports more complex data structures like lists, sets, and hashes.

• Pub/sub event-driven magic.

• Scriptable in Lua (like anyone cares).

10

Tuesday, October 2, 12

A PEEK INSIDE AMPEREHow, exactly, does the magic happen?

Tuesday, October 2, 12

AMPERE AT WORKAmpere stores models as Hashes in Redis at keys defined by

the class name.

Post

post.1

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

Relationships are stored in Redis as Sets of IDs.

Post Comment

post.1 post.1.comments

AMPERE AT WORK

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

AMPERE AT WORKRelationships are stored in Redis as Sets of IDs.

Post CommentComment

post.1 post.1.comments

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

AMPERE AT WORKRelationships are stored in Redis as Sets of IDs.

Post CommentCommentComment

post.1 post.1.comments

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

AMPERE AT WORKRelationships are stored in Redis as Sets of IDs.

Post CommentCommentComment

post.1 post.1.comments

Comment

{ title: “Hello World”, body: “Hi everybody.”}

Tuesday, October 2, 12

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

•Define fields with the field method

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

•Define fields with the field method

• Store whatever kind of data you want as long as it can be marshaled

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

•Define fields with the field method

• Store whatever kind of data you want as long as it can be marshaled

• Use has_one, has_many, and belongs_to as usual

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

•Define fields with the field method

• Store whatever kind of data you want as long as it can be marshaled

• Use has_one, has_many, and belongs_to as usual

• That’s it. (Srsly.)

USING AMPERERoll your own awesome.

Tuesday, October 2, 12

UNDER CONSTRUCTIONAmpere is under active development.There’s still more awesome to come.

Tuesday, October 2, 12

http://github.com/mstahlhttp://twitter.com/villainous

max@villainousindustri.es

23

For tracking me down

http://redis.io/

For learning about Redis

Here are some links

Tuesday, October 2, 12